From 389bd6b3d947dab08aa7fbce4540d1bd504e2446 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 9 Aug 2011 10:49:01 +0200 Subject: [PATCH] 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. --- ChangeLog | 13 +++++++++++++ tests/self-check-exit.tap | 25 +++++++++++++++++++++---- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73c3b25fa..97b0ae529 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2011-08-09 Stefano Lattarini + + 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 gitignore: update and improve for the testsuite files diff --git a/tests/self-check-exit.tap b/tests/self-check-exit.tap index 97bf3bc40..dc8cfda45 100755 --- a/tests/self-check-exit.tap +++ b/tests/self-check-exit.tap @@ -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. -- 2.47.2