* tests/defs (exit trap): Fix indentation left botched by previous patch `v1.11-1477-g8564a0d'. --- ChangeLog | 6 +++ tests/defs | 123 ++++++++++++++++++++++++++++++------------------------------ 2 files changed, 67 insertions(+), 62 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 4d7ed49..9afddef 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2011-10-17 Stefano Lattarini <stefano.lattar...@gmail.com> + test defs: fix indentation (cosmetic change) + * tests/defs (exit trap): Fix indentation left botched by + previous patch `v1.11-1477-g8564a0d'. + +2011-10-17 Stefano Lattarini <stefano.lattar...@gmail.com> + tests: remove obsolete uses of $sh_errexit_works After the last changes, configure will ensure that the shell selected to run the test scripts can correctly propagate exit diff --git a/tests/defs b/tests/defs index 44c670b..b7c8ae4 100644 --- a/tests/defs +++ b/tests/defs @@ -931,69 +931,68 @@ esac distdir=$me-1.0 # Set up the exit trap. -# FIXME: adjust indentation, here and below. - trap 'exit_status=$? - set +e - cd "$testbuilddir" - if test -n "$keep_testdirs"; then - keep_testdirs=yes - else - keep_testdirs=no - fi - if test $am_using_tap = yes; then - if test $have_tap_plan_ != yes && test $exit_status -eq 0; then - plan_ "now" - fi - test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \ - || keep_testdirs=yes - else - # This is to ensure that a test script does give a SKIP outcome just - # because a command in it happens to exit with status 77. This - # behaviour, while from time to time useful to developers, is not - # meant to be enabled by default, as it could cause spurious failures - # in the wild. Thus it will be enabled only when the variable - # "am_explicit_skips" is set to a "true" value. - case $am_explicit_skips in - [yY]|[yY]es|1) - if test $exit_status -eq 77 && test $am__test_skipped != yes; then - echo "$me: implicit skip turned into failure" - exit_status=78 - fi;; - esac - test $exit_status -eq 0 || keep_testdirs=yes +trap 'exit_status=$? + set +e + cd "$testbuilddir" + if test -n "$keep_testdirs"; then + keep_testdirs=yes + else + keep_testdirs=no + fi + if test $am_using_tap = yes; then + if test $have_tap_plan_ != yes && test $exit_status -eq 0; then + plan_ "now" fi - test $keep_testdirs = no && rm_rf_ $testSubDir - set +x - echo "$me: exit $exit_status" - exit $exit_status - ' 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 - # - Solaris 10 /bin/sh - # - 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 + test $exit_status -eq 0 && test $tap_pass_count_ -eq $tap_count_ \ + || keep_testdirs=yes + else + # This is to ensure that a test script does give a SKIP outcome just + # because a command in it happens to exit with status 77. This + # behaviour, while from time to time useful to developers, is not + # meant to be enabled by default, as it could cause spurious failures + # in the wild. Thus it will be enabled only when the variable + # "am_explicit_skips" is set to a "true" value. + case $am_explicit_skips in + [yY]|[yY]es|1) + if test $exit_status -eq 77 && test $am__test_skipped != yes; then + echo "$me: implicit skip turned into failure" + exit_status=78 + fi;; + esac + test $exit_status -eq 0 || keep_testdirs=yes + fi + test $keep_testdirs = no && rm_rf_ $testSubDir + set +x + echo "$me: exit $exit_status" + exit $exit_status +' 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 +# - Solaris 10 /bin/sh +# - 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 # Create and populate the temporary directory, if and as required. if test x"$am_create_testdir" = x"no"; then -- 1.7.2.3