]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
testsuite: fix spurious failures with Solaris /bin/sh
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 27 Jul 2011 13:33:13 +0000 (15:33 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 2 Aug 2011 21:03:31 +0000 (23:03 +0200)
* 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
tests/tap-more.test
tests/tap-numeric-description.test
tests/test-driver-custom-multitest-recheck2.test

index 694cd0b1d8f9f59299f1c772ab1de5e4cc265229..c1550e33405585d51a2775b52b415615831d1fe6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-07-27  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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  <stefano.lattarini@gmail.com>
 
        simple tests: support developer-defined fd redirections
index 72fcaac49a4c3d8c1492c65147a6d4e8175ba675..7d0bf86a0cc57b1c0bf2b4b464475c64b776f6ef 100755 (executable)
@@ -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
index 67b3733abcc3047f7247091594849f490683e4ef..a2b4f79c7af7eafc6a632cb0fc36e6892e57aa50 100755 (executable)
@@ -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<n> != <n> 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 <<END
 1..10
-ok 1 ${1}
-ok - ${2}
-not ok 3 ${3}
-not ok - ${4}
-ok 5 ${5} # SKIP
-ok - ${6} # SKIP
-not ok 7 ${7} # TODO
-not ok - ${8} # TODO
-ok 9 ${9} # TODO
-ok - ${10} # TODO
+ok 1 ${x1}
+ok - ${x2}
+not ok 3 ${x3}
+not ok - ${x4}
+ok 5 ${x5} # SKIP
+ok - ${x6} # SKIP
+not ok 7 ${x7} # TODO
+not ok - ${x8} # TODO
+ok 9 ${x9} # TODO
+ok - ${x10} # TODO
 END
 
 cat > exp <<END
-PASS: all.test 1 ${1}
-PASS: all.test 2 - ${2}
-FAIL: all.test 3 ${3}
-FAIL: all.test 4 - ${4}
-SKIP: all.test 5 ${5} # SKIP
-SKIP: all.test 6 - ${6} # SKIP
-XFAIL: all.test 7 ${7} # TODO
-XFAIL: all.test 8 - ${8} # TODO
-XPASS: all.test 9 ${9} # TODO
-XPASS: all.test 10 - ${10} # TODO
+PASS: all.test 1 ${x1}
+PASS: all.test 2 - ${x2}
+FAIL: all.test 3 ${x3}
+FAIL: all.test 4 - ${x4}
+SKIP: all.test 5 ${x5} # SKIP
+SKIP: all.test 6 - ${x6} # SKIP
+XFAIL: all.test 7 ${x7} # TODO
+XFAIL: all.test 8 - ${x8} # TODO
+XPASS: all.test 9 ${x9} # TODO
+XPASS: all.test 10 - ${x10} # TODO
 END
 
 $ACLOCAL
index ed08675981ac3c12c222c9be82ce1ffa9160f472..0d254dc342f94a6b5978054d71154b98576d6867 100755 (executable)
@@ -145,7 +145,9 @@ for vpath in : false; do
   : No need to re-run a.test anymore, but c.test should be rerun,
   : as it contained an XPASS.  And this time, make it fail with
   : an hard error.
-  : > 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