]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
testsuite: fix weird spurious failure with Solaris /bin/sh
authorStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 7 Aug 2011 21:48:02 +0000 (23:48 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Sun, 7 Aug 2011 21:48:02 +0000 (23:48 +0200)
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:
 <http://dbaspot.com/shell/396118-bourne-shell-exit-code-term.html>
Work around this incompatibility.

* tap-signal.test: Look for the above Solaris bug.
(signal_caught): Adapt to handle it.

ChangeLog
tests/tap-signal.test

index 61e01d0a59cc9ad78dcedef94d6e768d4f0f9163..d50418d8e6dbeed3aaccd2de953040205626c5d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
+
+       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:
+        <http://dbaspot.com/shell/396118-bourne-shell-exit-code-term.html>
+       Work around this incompatibility.
+       * tap-signal.test: Look for the above Solaris bug.
+       (signal_caught): Adapt to handle it.
+
 2011-08-07  Stefano Lattarini  <stefano.lattarini@gmail.com>
 
        testsuite: fix another spurious failure on Solaris make
index ce75dddbf52c5fb5f8de5b3754eb313d4745f427..8ceedddb60576d4e37fa5f54875754f6a5eba8a0 100755 (executable)
@@ -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:
+#   <http://dbaspot.com/shell/396118-bourne-shell-exit-code-term.html>
+# 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 ()