From: Stefano Lattarini Date: Sun, 7 Aug 2011 21:48:02 +0000 (+0200) Subject: testsuite: fix weird spurious failure with Solaris /bin/sh X-Git-Tag: ng-0.5a~89^2~132^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ef3ef52079a967a4ef15968fb2054f1b215e7fb;p=thirdparty%2Fautomake.git testsuite: fix weird spurious failure with Solaris /bin/sh Solaris /bin/sh, when killed with a SIGTERM or SIGINT signal, can apparently end up exiting with exit status 208, instead of leaving the correct wide exit status to the parent. See: Work around this incompatibility. * tap-signal.test: Look for the above Solaris bug. (signal_caught): Adapt to handle it. --- diff --git a/ChangeLog b/ChangeLog index 61e01d0a5..d50418d8e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-08-07 Stefano Lattarini + + testsuite: fix weird spurious failure with Solaris /bin/sh + Solaris /bin/sh, when killed with a SIGTERM or SIGINT signal, can + apparently end up exiting with exit status 208, instead of leaving + the correct wide exit status to the parent. See: + + Work around this incompatibility. + * tap-signal.test: Look for the above Solaris bug. + (signal_caught): Adapt to handle it. + 2011-08-07 Stefano Lattarini testsuite: fix another spurious failure on Solaris make diff --git a/tests/tap-signal.test b/tests/tap-signal.test index ce75dddbf..8ceedddb6 100755 --- a/tests/tap-signal.test +++ b/tests/tap-signal.test @@ -36,13 +36,36 @@ chmod a+x *.test . "$testsrcdir"/tap-setup.sh || fatal_ "sourcing tap-setup.sh" +# Solaris /bin/sh, when killed with a SIGTERM or SIGINT signal, can end up +# exiting with exit status 208, instead of leaving the correct wide exit +# status to the parent. See: +# +# We need to detect and work around this incompatibility. + +if /bin/sh -c 'kill -2 $$'; then + fatal_ "/bin/sh cannot kill itself" +elif test $? -eq 208; then + have_solaris_bug=yes +else + have_solaris_bug=no +fi + signal_caught () { numeric=$1 symbolic=$2 sig_re="((SIG)?$symbolic|$numeric)" tst_re="signal-$numeric\\.test" - $EGREP "^ERROR: $tst_re - terminated by signal $sig_re$" stdout + if $EGREP "^ERROR: $tst_re - terminated by signal $sig_re$" stdout; then + return 0 + elif test $have_solaris_bug = yes; then + case $symbolic in + INT|TERM) $EGREP "^ERROR: $tst_re - exited with status 208$" stdout;; + *) return 1;; + esac + else + return 1 + fi } all_signals_caught ()