[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 17/32] test init: refactor: new function 'am_set_exit_traps'
From: |
Stefano Lattarini |
Subject: |
[PATCH 17/32] test init: refactor: new function 'am_set_exit_traps' |
Date: |
Thu, 26 Jul 2012 14:04:43 +0200 |
* t/ax/test-init.sh (am_set_exit_traps): Here.
(trap): Use it instead of inlining the cleanup/finalization code.
Signed-off-by: Stefano Lattarini <address@hidden>
---
t/ax/test-init.sh | 59 ++++++++++++++++++++++++++++++-------------------------
1 file changed, 32 insertions(+), 27 deletions(-)
diff --git a/t/ax/test-init.sh b/t/ax/test-init.sh
index 47fb1cb..2b745dd 100644
--- a/t/ax/test-init.sh
+++ b/t/ax/test-init.sh
@@ -933,33 +933,38 @@ am_exit_trap ()
\exit $exit_status
}
-trap 'am_exit_trap $?' 0
-trap "fatal_ 'caught signal SIGHUP'" 1
-trap "fatal_ 'caught signal SIGINT'" 2
-trap "fatal_ 'caught signal SIGTERM'" 15
-# Various shells seems to just ignore SIGQUIT under some circumstances,
-# even if the signal is not blocked; however, if the signal it trapped,
-# the trap gets correctly executed. So we also trap SIGQUIT.
-# Here is a list of some shells that have been verified to exhibit the
-# problematic behavior with SIGQUIT:
-# - zsh 4.3.12 on Debian GNU/Linux
-# - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
-# - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
-# - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
-# OTOH, at least these shells that do *not* exhibit that behaviour:
-# - modern version of the Almquist Shell (at least 0.5.5.1), on
-# both Solaris and GNU/Linux
-# - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
-trap "fatal_ 'caught signal SIGQUIT'" 3
-# Ignore further SIGPIPE in the trap code. This is required to avoid
-# a very weird issue with some shells, at least when the execution of
-# the automake testsuite is driven by the 'prove' utility: if prove
-# (or the make process that has spawned it) gets interrupted with
-# Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
-# sometimes finally dumping core, other times hanging indefinitely.
-# See also Test::Harness bug [rt.cpan.org #70855], archived at
-# <https://rt.cpan.org/Ticket/Display.html?id=70855>
-trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
+am_set_exit_traps ()
+{
+ trap 'am_exit_trap $?' 0
+ trap "fatal_ 'caught signal SIGHUP'" 1
+ trap "fatal_ 'caught signal SIGINT'" 2
+ trap "fatal_ 'caught signal SIGTERM'" 15
+ # Various shells seems to just ignore SIGQUIT under some circumstances,
+ # even if the signal is not blocked; however, if the signal it trapped,
+ # the trap gets correctly executed. So we also trap SIGQUIT.
+ # Here is a list of some shells that have been verified to exhibit the
+ # problematic behavior with SIGQUIT:
+ # - zsh 4.3.12 on Debian GNU/Linux
+ # - /bin/ksh and /usr/xpg4/bin/sh on Solaris 10
+ # - Bash 3.2.51 on Solaris 10 and bash 4.1.5 on Debian GNU/Linux
+ # - AT&T ksh on Debian Gnu/Linux (deb package ksh, version 93u-1)
+ # OTOH, at least these shells that do *not* exhibit that behaviour:
+ # - modern version of the Almquist Shell (at least 0.5.5.1), on
+ # both Solaris and GNU/Linux
+ # - public domain Korn Shell, version 5.2.14, on Debian GNU/Linux
+ trap "fatal_ 'caught signal SIGQUIT'" 3
+ # Ignore further SIGPIPE in the trap code. This is required to avoid
+ # a very weird issue with some shells, at least when the execution of
+ # the automake testsuite is driven by the 'prove' utility: if prove
+ # (or the make process that has spawned it) gets interrupted with
+ # Ctrl-C, the shell might go in a loop, continually getting a SIGPIPE,
+ # sometimes finally dumping core, other times hanging indefinitely.
+ # See also Test::Harness bug [rt.cpan.org #70855], archived at
+ # <https://rt.cpan.org/Ticket/Display.html?id=70855>
+ trap "trap '' 13; fatal_ 'caught signal SIGPIPE'" 13
+}
+
+am_set_exit_traps
# Create and populate the temporary directory, if and as required.
if test x"$am_create_testdir" = x"no"; then
--
1.7.12.rc0
- [PATCH 09/32] tests: update PATH early from AM_TESTS_ENVIRONMENT and runtest, (continued)
- [PATCH 09/32] tests: update PATH early from AM_TESTS_ENVIRONMENT and runtest, Stefano Lattarini, 2012/07/26
- [PATCH 06/32] gen-tests: less hard-coding of 't' as the test directory, Stefano Lattarini, 2012/07/26
- [PATCH 10/32] test defs: move in 't/ax/test-defs.sh', Stefano Lattarini, 2012/07/26
- [PATCH 08/32] runtest: export $srcdir for use by the test scripts, Stefano Lattarini, 2012/07/26
- [PATCH 12/32] test init: remove a couple of paranoid sanity checks, Stefano Lattarini, 2012/07/26
- [PATCH 15/32] test init: refactor: new function 'am_exit_trap', Stefano Lattarini, 2012/07/26
- [PATCH 14/32] test init: refactor: new function 'process_requirements', Stefano Lattarini, 2012/07/26
- [PATCH 18/32] test init: refactor: new function 'am_setup_testdir', Stefano Lattarini, 2012/07/26
- [PATCH 13/32] test init: refactor: new function 'require_tool', Stefano Lattarini, 2012/07/26
- [PATCH 17/32] test init: refactor: new function 'am_set_exit_traps',
Stefano Lattarini <=
- [PATCH 11/32] tests: simplify sourcing of helper shell files, Stefano Lattarini, 2012/07/26
- [PATCH 19/32] test init: refactor: move displaying of debugging info later, Stefano Lattarini, 2012/07/26
- [PATCH 16/32] configure: testsuite shell set exit traps in shell functions, Stefano Lattarini, 2012/07/26
- [PATCH 21/32] test setup: merge definitions of function for simple tests, Stefano Lattarini, 2012/07/26
- [PATCH 23/32] tests: split test libs into "generic" and "automake-specific", Stefano Lattarini, 2012/07/26
- [PATCH 27/32] configure: testsuite shell can return early from "dot-sourced" files, Stefano Lattarini, 2012/07/26
- [PATCH 25/32] tests: source test defs in the generic test lib, Stefano Lattarini, 2012/07/26
- [PATCH 22/32] test setup: move actual calling of testsuite setup in ./defs, Stefano Lattarini, 2012/07/26
- [PATCH 26/32] tests: move sanitization and "Bournification" in the generic test lib, Stefano Lattarini, 2012/07/26
- [PATCH 24/32] test defs: no need to re-add $srcdir/t/ax to $PATH, Stefano Lattarini, 2012/07/26