[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FYI] {GSoC} tests: fix spurious failures with Solaris /bin/sh
From: |
Stefano Lattarini |
Subject: |
[FYI] {GSoC} tests: fix spurious failures with Solaris /bin/sh |
Date: |
Wed, 27 Jul 2011 18:44:43 +0200 |
User-agent: |
KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; ) |
* 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 +++++++++++-----------
tests/test-driver-custom-multitest-recheck2.test | 7 ++-
4 files changed, 50 insertions(+), 28 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 34fea0b..7ff8cbe 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2011-07-27 Stefano Lattarini <address@hidden>
+
+ tests: 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-24 Stefano Lattarini <address@hidden>
simple tests: support developer-defined fd redirections
diff --git a/tests/tap-more.test b/tests/tap-more.test
index 72fcaac..7d0bf86 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 67b3733..a2b4f79 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<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
diff --git a/tests/test-driver-custom-multitest-recheck2.test
b/tests/test-driver-custom-multitest-recheck2.test
index ed08675..0d254dc 100755
--- a/tests/test-driver-custom-multitest-recheck2.test
+++ b/tests/test-driver-custom-multitest-recheck2.test
@@ -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
--
1.7.2.3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [FYI] {GSoC} tests: fix spurious failures with Solaris /bin/sh,
Stefano Lattarini <=