automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FYI] {test-protocols} testsuite: fix weird spurious failure with Solari


From: Stefano Lattarini
Subject: [FYI] {test-protocols} testsuite: fix weird spurious failure with Solaris /bin/sh
Date: Sun, 7 Aug 2011 23:49:45 +0200
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

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             |   11 +++++++++++
 tests/tap-signal.test |   25 ++++++++++++++++++++++++-
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 61e01d0..d50418d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2011-08-07  Stefano Lattarini  <address@hidden>
 
+       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  <address@hidden>
+
        testsuite: fix another spurious failure on Solaris make
        * tests/parallel-tests-log-override-recheck.test: Filter make
        output before grepping it, for make implementations that, like
diff --git a/tests/tap-signal.test b/tests/tap-signal.test
index ce75ddd..8ceeddd 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:
+#   <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 ()
-- 
1.7.2.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]