automake-patches
[Top][All Lists]
Advanced

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

[FYI] {master} tests: fix spurious failures due to ignored signals


From: Stefano Lattarini
Subject: [FYI] {master} tests: fix spurious failures due to ignored signals
Date: Tue, 6 Sep 2011 17:46:29 +0200

* tests/defs (is_blocked_signal): New function.
* tests/parallel-tests-interrupt.test: Do not try to use/trap
signals that are ignored by the parent shell: they will be
ignored by all the child processes too.
* tests/self-check-exit.test: Likewise.
* tests/self-check-cleanup.test: Likewise, and do few minor
improvements and extensions since we are at it.
---
 ChangeLog                           |   11 +++++++++++
 tests/defs                          |    9 +++++++++
 tests/parallel-tests-interrupt.test |    4 ++++
 tests/self-check-cleanup.test       |   30 ++++++++++++++----------------
 tests/self-check-exit.test          |    4 ++++
 5 files changed, 42 insertions(+), 16 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 5b9f6e9..54d7554 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2011-09-06  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failures due to ignored signals
+       * tests/defs (is_blocked_signal): New function.
+       * tests/parallel-tests-interrupt.test: Do not try to use/trap
+       signals that are ignored by the parent shell: they will be
+       ignored by all the child processes too.
+       * tests/self-check-exit.test: Likewise.
+       * tests/self-check-cleanup.test: Likewise, and do few minor
+       improvements and extensions since we are at it.
+
 2011-09-05  Peter Rosin  <address@hidden>
 
        * tests/amhello-binpkg.test: Add missing $EXEEXT usage.
diff --git a/tests/defs b/tests/defs
index fe73d85..2c43bc1 100644
--- a/tests/defs
+++ b/tests/defs
@@ -153,6 +153,15 @@ is_newest ()
   test -z "$is_newest_files"
 }
 
+# is_blocked_signal SIGNAL-NUMBER
+# --------------------------------
+# Return success if the given signal number is blocked in the shell,
+# return a non-zero exit status and print a proper diagnostic otherwise.
+is_blocked_signal ()
+{
+  $SHELL -c "kill -$1 \$\$; echo '$me: signal $1 seems blocked'"
+}
+
 # AUTOMAKE_run status [options...]
 # --------------------------------
 # Run Automake with OPTIONS, and fail if automake
diff --git a/tests/parallel-tests-interrupt.test 
b/tests/parallel-tests-interrupt.test
index 45e55d4..7305222 100755
--- a/tests/parallel-tests-interrupt.test
+++ b/tests/parallel-tests-interrupt.test
@@ -57,6 +57,10 @@ $AUTOMAKE -a
 trapped_signals='1 2 13 15'
 
 for signum in $trapped_signals; do
+  if is_blocked_signal $signum; then
+    echo "$me: signal $signum is blocked, skipping part of the test"
+    continue
+  fi
   rm -f pid fail *.log *.log-t
   env signum=$signum $MAKE check && { ls -l; Exit 1; }
   ls -l
diff --git a/tests/self-check-cleanup.test b/tests/self-check-cleanup.test
index 945194f..9cfde1d 100755
--- a/tests/self-check-cleanup.test
+++ b/tests/self-check-cleanup.test
@@ -108,23 +108,21 @@ fi # $have_symlinks
 # Check that the cleanup trap does not remove the temporary
 # test directory in case of test failure, skip, hard-error,
 # or when receiving a signal.
-for bailout_command in \
-  'Exit 1' \
-  'Exit 2' \
-  'Exit 10' \
-  'Exit 77' \
-  'Exit 99' \
-  'Exit 126' \
-  'Exit 127' \
-  'Exit 255' \
-  'kill -1 $$' \
-  'kill -2 $$' \
-  'kill -9 $$' \
-  'kill -13 $$' \
-  'kill -15 $$' \
-; do
-  $SHELL -c  ". ./defs; : > foo; $bailout_command" dummy.test && Exit 1
+
+for st in 1 2 3 10 77 99 126 127 130 255; do
+  $SHELL -c  ". ./defs; : > foo; Exit $st" dummy.test && Exit 1
+  test -f dummy.dir/foo
+  rm -rf dummy.dir
+done
+
+for signum in 1 2 3 9 13 15; do
+  if is_blocked_signal $signum; then
+    echo "$me: signal $signum is blocked, skipping part of the test"
+    continue
+  fi
+  $SHELL -c  ". ./defs; : > foo; kill -$signum \$\$" dummy.test && Exit 1
   test -f dummy.dir/foo
+  rm -rf dummy.dir
 done
 
 :
diff --git a/tests/self-check-exit.test b/tests/self-check-exit.test
index ca1af9b..a07ba69 100755
--- a/tests/self-check-exit.test
+++ b/tests/self-check-exit.test
@@ -50,6 +50,10 @@ done
 
 for sig in 1 2 13 15; do
 
+  if $SHELL -c "kill -$sig \$\$"; then
+    echo "$me: signal $sig is blocked, skipping part of the test"
+    continue
+  fi
   echo "* Try: kill -$sig \$\$"
   if test $sig -eq 2; then
     # Some Korn shells might otherwise get a spurious SIGINT
-- 
1.7.2.3




reply via email to

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