From: Tracey Emery Subject: Re: New and fixed tests To: Christian Weisgerber Cc: gameoftrees@openbsd.org Date: Tue, 14 Sep 2021 16:36:07 -0600 On Tue, Sep 14, 2021 at 11:37:51PM +0200, Christian Weisgerber wrote: > Tracey Emery: > > > Now with less duplication. > > That needs some shell fixes: > I'm happy you're here to fix my mistakes. :D Shell is hard. > > --- regress/cmdline/checkout.sh > > +++ regress/cmdline/checkout.sh > ... > > + echo -n "Checked out refs/heads/master: " >> $testroot/stdout.expected > > + git_show_head $testroot/repo >> $testroot/stdout.expected > > + echo "\nNow shut up and hack" >> $testroot/stdout.expected > > echo with escape sequences is not portable in practice. > This blew up the test on FreeBSD. > > > --- regress/cmdline/status.sh > > +++ regress/cmdline/status.sh > ... > > + echo 'M alpha' > $testroot/stdout.expected > > + (cd $testroot/wt && got status -S D?A\! > $testroot/stdout) > > '?' is a shell glob character ("match any character") and needs to be > quoted. '!' is not a meta character and doesn't need quoting. > (It introduces history substitution in an _interactive_ bash.) > > > diff f0fd0aafb69cafd7c84dd294cffda4b3c1d6144a /home/naddy/got > blob - 7e75429e4fe31fb4f4ec10afbd607d1b71f67721 > file + regress/cmdline/checkout.sh > --- regress/cmdline/checkout.sh > +++ regress/cmdline/checkout.sh > @@ -821,7 +821,7 @@ test_checkout_quiet() { > > echo -n "Checked out refs/heads/master: " >> $testroot/stdout.expected > git_show_head $testroot/repo >> $testroot/stdout.expected > - echo "\nNow shut up and hack" >> $testroot/stdout.expected > + printf "\nNow shut up and hack\n" >> $testroot/stdout.expected > > got checkout -q $testroot/repo $testroot/wt > $testroot/stdout > ret="$?" > blob - 47f3fb72e870ae3ea6d9b9aa4148243c8f217315 > file + regress/cmdline/status.sh > --- regress/cmdline/status.sh > +++ regress/cmdline/status.sh > @@ -746,7 +746,7 @@ test_status_status_code() { > > echo '! epsilon/zeta' > $testroot/stdout.expected > echo '? foo' >> $testroot/stdout.expected > - (cd $testroot/wt && got status -s \!? > $testroot/stdout) > + (cd $testroot/wt && got status -s !\? > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -878,7 +878,7 @@ test_status_suppress() { > fi > > echo 'M alpha' > $testroot/stdout.expected > - (cd $testroot/wt && got status -S D?A\! > $testroot/stdout) > + (cd $testroot/wt && got status -S D\?A! > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -888,7 +888,7 @@ test_status_suppress() { > fi > > echo 'D beta' > $testroot/stdout.expected > - (cd $testroot/wt && got status -S M?A\! > $testroot/stdout) > + (cd $testroot/wt && got status -S M\?A! > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -909,7 +909,7 @@ test_status_suppress() { > fi > > echo 'A new' > $testroot/stdout.expected > - (cd $testroot/wt && got status -S MD?\! > $testroot/stdout) > + (cd $testroot/wt && got status -S MD\?! > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -921,7 +921,7 @@ test_status_suppress() { > (cd $testroot/wt && got stage new > $testroot/stdout) > > echo ' A new' > $testroot/stdout.expected > - (cd $testroot/wt && got status -S MD?\! > $testroot/stdout) > + (cd $testroot/wt && got status -S MD\?! > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -934,7 +934,7 @@ test_status_suppress() { > > echo 'M alpha' > $testroot/stdout.expected > echo 'MA new' >> $testroot/stdout.expected > - (cd $testroot/wt && got status -S D?\! > $testroot/stdout) > + (cd $testroot/wt && got status -S D\?! > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -944,7 +944,7 @@ test_status_suppress() { > fi > > echo 'M alpha' > $testroot/stdout.expected > - (cd $testroot/wt && got status -S AD?\! > $testroot/stdout) > + (cd $testroot/wt && got status -S AD\?! > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > @@ -956,7 +956,7 @@ test_status_suppress() { > rm $testroot/stdout.expected > touch $testroot/stdout.expected > > - (cd $testroot/wt && got status -S MD?\! > $testroot/stdout) > + (cd $testroot/wt && got status -S MD\?! > $testroot/stdout) > cmp -s $testroot/stdout.expected $testroot/stdout > ret="$?" > if [ "$ret" != "0" ]; then > -- > Christian "naddy" Weisgerber naddy@mips.inka.de -- Tracey Emery