self tests: register an expected failures with Solaris /bin/sh
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 9 Aug 2011 08:49:01 +0000 (10:49 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 9 Aug 2011 09:03:07 +0000 (11:03 +0200)
Solaris 10 /bin/sh erroneously exit with success right away when
the following three conditions are met at the same time:
 1. the `errexit' flag is active,
 2. an exit trap is installed, and
 3. a non-existing command is issued.

* tests/self-exit.tap: When that bug is detected, issue an XFAIL
rather than a FAIL.  Since we are at it, improve by avoiding
creation of stray temporary files when testing for non-executable
commands.

ChangeLog
tests/self-check-exit.tap

index 73c3b25..97b0ae5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
+       self tests: register an expected failures with Solaris /bin/sh
+       Solaris 10 /bin/sh erroneously exit with success right away when
+       the following three conditions are met at the same time:
+        1. the `errexit' flag is active,
+        2. an exit trap is installed, and
+        3. a non-existing command is issued.
+       * tests/self-exit.tap: When that bug is detected, issue an XFAIL
+       rather than a FAIL.  Since we are at it, improve by avoiding
+       creation of stray temporary files when testing for non-executable
+       commands.
+
+2011-08-09  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
        gitignore: update and improve for the testsuite files
        * tests/.gitignore: Don't ignore temporary partial log files,
        autogenerated tests and makefile fragments that are not used
index 97bf3bc..dc8cfda 100755 (executable)
@@ -61,12 +61,29 @@ for sig in 1 2 13 15; do
 done
 
 : Non-existent program.
-rc=0; $SHELL -c  ". ./defs; non-existent-program; :" || rc=$?
-command_ok_ "command not found" test $rc -gt 0
+# Solaris 10 /bin/sh erroneously exit with success right away when the
+# following three conditions are met at the same time:
+#   1. the `errexit' flag is active,
+#   2. an exit trap is installed, and
+#   3. a non-existing command is issued.
+# Note that the non-existent command is issued as the last command to
+# the shell in the next line; this is deliberate.
+if $SHELL -c 'set -e; trap "exit \$?" 0; non-existent-program'; then
+  maybe_todo=TODO reason="known Solaris /bin/sh bug"
+else
+  maybe_todo="" reason=""
+fi
+if $SHELL -c  ". ./defs; non-existent-program; :"; then
+  r='not ok'
+else
+  r='ok'
+fi
+result_ "$r" -D "$maybe_todo" -r "$reason" "command not found"
 
 : Non-executable command.
-: > non-executable
-rc=0; $SHELL -c  ". ./defs; ./non-executable; :" || rc=$?
+test -f Makefile && test ! -x Makefile || \
+  framowork_failure_ "no proper Makefile in the current directory"
+rc=0; $SHELL -c  ". ./defs; ./Makefile; :" || rc=$?
 command_ok_ "permission denied" test $rc -gt 0
 
 : Syntax errors in the test code.