From 50c32b61b305cb8c2965470927522ed2f226b917 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 27 Jul 2011 15:33:13 +0200 Subject: [PATCH] testsuite: fix spurious failures with Solaris /bin/sh * tests/tap-more.test: Use `echo > file', not `: > file', to create empty files in the "for" loops; this is required since, as documented in the autoconf manual, Solaris 10 /bin/sh "optimizes" away the `:' command after the first iteration, even if it is redirected. * tests/test-driver-custom-multitest-recheck2.test: Likewise. * tests/tap-numeric-description.test: Partial rewrite to avoid using positional parameters from the 10th onward, which are unportable to Solaris /bin/sh (using `${10}' causes the shell to die with "bad substitution"). --- ChangeLog | 14 ++++++ tests/tap-more.test | 8 ++- tests/tap-numeric-description.test | 49 ++++++++++--------- ...test-driver-custom-multitest-recheck2.test | 7 ++- 4 files changed, 50 insertions(+), 28 deletions(-) diff --git a/ChangeLog b/ChangeLog index 694cd0b1d..c1550e334 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2011-07-27 Stefano Lattarini + + testsuite: fix spurious failures with Solaris /bin/sh + * tests/tap-more.test: Use `echo > file', not `: > file', to + create empty files in the "for" loops; this is required since, + as documented in the autoconf manual, Solaris 10 /bin/sh + "optimizes" away the `:' command after the first iteration, + even if it is redirected. + * tests/test-driver-custom-multitest-recheck2.test: Likewise. + * tests/tap-numeric-description.test: Partial rewrite to avoid + using positional parameters from the 10th onward, which are + unportable to Solaris /bin/sh (using `${10}' causes the shell + to die with "bad substitution"). + 2011-07-31 Stefano Lattarini simple tests: support developer-defined fd redirections diff --git a/tests/tap-more.test b/tests/tap-more.test index 72fcaac49..7d0bf86a0 100755 --- a/tests/tap-more.test +++ b/tests/tap-more.test @@ -119,6 +119,7 @@ for try in 0 1; do ls -l # For debugging. # Success. + $run_make check >stdout || { cat stdout; Exit 1; } cat stdout count_test_results total=6 pass=4 fail=0 xpass=0 xfail=1 skip=1 error=0 @@ -134,8 +135,11 @@ for try in 0 1; do test `$FGREP -c '3.test' stdout` -eq 2 # Failure. - : > not-skip - : > bail-out + + # Use `echo' here, since Solaris 10 /bin/sh would try to optimize + # a `:' away after the first iteration, even if it is redirected. + echo dummy > not-skip + echo dummy > bail-out $run_make check >stdout && { cat stdout; Exit 1; } cat stdout count_test_results total=7 pass=4 fail=1 xpass=0 xfail=1 skip=0 error=1 diff --git a/tests/tap-numeric-description.test b/tests/tap-numeric-description.test index 67b3733ab..a2b4f79c7 100755 --- a/tests/tap-numeric-description.test +++ b/tests/tap-numeric-description.test @@ -33,36 +33,37 @@ TEST_LOG_COMPILER = cat TESTS = all.test END -# Some random numbers to be used as test names. -# These are selected so that $n != n for every n >= 1. -set 5 7 45 11 7 3 6 9 1000 1 -# $1 $2 $3 $4 $5 $6 $7 $8 $9 $10 +# Some random numbers to be used as test names. The definitions below are +# selected so that $x != for every n >= 1. We can't use positional +# parameters for this unfortunately, since Solaris 10 /bin/sh doesn't allow +# the dereferencing of parameters from ${10} onwards. +x1=5 x2=7 x3=45 x4=11 x5=7 x6=3 x7=6 x8=9 x9=1000 x10=1 cat > all.test < exp < c.err + # Use `echo' here, since Solaris 10 /bin/sh would try to optimize + # a `:' away after the first iteration, even if it is redirected. + echo dummy > c.err env TEST_LOGS='a.log c.log' $MAKE -e recheck >stdout \ && { cat stdout; Exit 1; } cat stdout @@ -158,7 +160,8 @@ for vpath in : false; do : c.test contained and hard error the last time, so it should be re-run. : This time, make it pass - : > c.ok + # Use `echo', not `:'; see comments above for why. + echo dummy > c.ok env TESTS='c.test a.test' $MAKE -e recheck >stdout \ || { cat stdout; Exit 1; } cat stdout -- 2.47.2