* 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-06 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ 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 <peda@lysator.liu.se>
* tests/amhello-binpkg.test: Add missing $EXEEXT usage.
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
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
# 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
:
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