After the last changes, configure will ensure that the shell selected to run the test scripts can correctly propagate exit status to the exit trap when `set -e' is in effect.
* configure.ac (sh_errexit_works): Do not AC_SUBST it anymore. * tests/defs-static.in (sh_errexit_works): Do not initialize from the AC_SUBST value anymore. * tests/Makefile.am (do_subst): Do not substitute it anymore. * tests/defs (trap): Trap the EXIT signal unconditionally. * tests/self-check-explicit-skips.test: Do not skip the test if `$sh_errexit_works' is != "yes", this check doesn't make sense anymore. * tests/self-check-cleanup.tap: Likewise. * tests/self-check-exit.tap: Assume the exit trap is always installed by ./defs. --- ChangeLog | 18 ++++++++++++++++++ Makefile.in | 1 - configure | 5 ----- configure.ac | 3 --- doc/Makefile.in | 1 - lib/Automake/Makefile.in | 1 - lib/Automake/tests/Makefile.in | 1 - lib/Makefile.in | 1 - lib/am/Makefile.in | 1 - m4/Makefile.in | 1 - tests/Makefile.am | 1 - tests/Makefile.in | 2 -- tests/defs | 3 +-- tests/defs-static.in | 3 --- tests/self-check-cleanup.tap | 4 ---- tests/self-check-exit.tap | 13 +------------ tests/self-check-explicit-skips.test | 2 -- 17 files changed, 20 insertions(+), 41 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9377362..4d7ed49 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,23 @@ 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 + status to the exit trap when `set -e' is in effect. + * configure.ac (sh_errexit_works): Do not AC_SUBST it anymore. + * tests/defs-static.in (sh_errexit_works): Do not initialize from + the AC_SUBST value anymore. + * tests/Makefile.am (do_subst): Do not substitute it anymore. + * tests/defs (trap): Trap the EXIT signal unconditionally. + * tests/self-check-explicit-skips.test: Do not skip the test if + `$sh_errexit_works' is != "yes", this check doesn't make sense + anymore. + * tests/self-check-cleanup.tap: Likewise. + * tests/self-check-exit.tap: Assume the exit trap is always + installed by ./defs. + +2011-10-17 Stefano Lattarini <stefano.lattar...@gmail.com> + configure: search a sturdy POSIX shell to be used in the testsuite * configure.ac: Add code (partially inspired to checks in gnulib's `tests/init.sh') to search for a good-enough, not-buggy POSIX/XSI diff --git a/Makefile.in b/Makefile.in index 97aae10..1a49922 100644 --- a/Makefile.in +++ b/Makefile.in @@ -258,7 +258,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ diff --git a/configure b/configure index 186fcf0..82ccfd4 100755 --- a/configure +++ b/configure @@ -568,7 +568,6 @@ PACKAGE_URL='http://www.gnu.org/software/automake/' ac_unique_file="automake.in" ac_subst_vars='LTLIBOBJS LIBOBJS -sh_errexit_works AM_TEST_RUNNER_SHELL am_candidate_sh FGREP @@ -3148,10 +3147,6 @@ fi -# FIXME: remove soon -sh_errexit_works=yes - - ## ---------------------- ## ## Create output files. ## ## ---------------------- ## diff --git a/configure.ac b/configure.ac index 5a3f966..7dba220 100644 --- a/configure.ac +++ b/configure.ac @@ -355,9 +355,6 @@ fi AC_ARG_VAR([AM_TEST_RUNNER_SHELL], [a sturdy POSIX shell for our testsuite]) -# FIXME: remove soon -AC_SUBST([sh_errexit_works], [yes]) - ## ---------------------- ## ## Create output files. ## ## ---------------------- ## diff --git a/doc/Makefile.in b/doc/Makefile.in index bd53c47..407b41d 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -240,7 +240,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in index d520283..7cb2ce3 100644 --- a/lib/Automake/Makefile.in +++ b/lib/Automake/Makefile.in @@ -239,7 +239,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in index cf978dc..3c63ba1 100644 --- a/lib/Automake/tests/Makefile.in +++ b/lib/Automake/tests/Makefile.in @@ -278,7 +278,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ diff --git a/lib/Makefile.in b/lib/Makefile.in index ab5d68f..7bfa868 100644 --- a/lib/Makefile.in +++ b/lib/Makefile.in @@ -242,7 +242,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in index 8027d65..a45ef09 100644 --- a/lib/am/Makefile.in +++ b/lib/am/Makefile.in @@ -199,7 +199,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ diff --git a/m4/Makefile.in b/m4/Makefile.in index 17a5a79..7b9ed84 100644 --- a/m4/Makefile.in +++ b/m4/Makefile.in @@ -200,7 +200,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ diff --git a/tests/Makefile.am b/tests/Makefile.am index 9896d7d..91f2488 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -145,7 +145,6 @@ do_subst = sed \ -e 's|@am_AUTORECONF[@]|$(am_AUTORECONF)|g' \ -e 's|@am_AUTOHEADER[@]|$(am_AUTOHEADER)|g' \ -e 's|@am_AUTOUPDATE[@]|$(am_AUTOUPDATE)|g' \ - -e 's|@sh_errexit_works[@]|$(sh_errexit_works)|g' \ -e 's|@configure_input[@]|Generated from $@.in. DO NOT EDIT BY HAND!|' defs-static: defs-static.in diff --git a/tests/Makefile.in b/tests/Makefile.in index 198b0eb..3da0b7f 100644 --- a/tests/Makefile.in +++ b/tests/Makefile.in @@ -284,7 +284,6 @@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ scriptdir = @scriptdir@ -sh_errexit_works = @sh_errexit_works@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ @@ -1655,7 +1654,6 @@ do_subst = sed \ -e 's|@am_AUTORECONF[@]|$(am_AUTORECONF)|g' \ -e 's|@am_AUTOHEADER[@]|$(am_AUTOHEADER)|g' \ -e 's|@am_AUTOUPDATE[@]|$(am_AUTOUPDATE)|g' \ - -e 's|@sh_errexit_works[@]|$(sh_errexit_works)|g' \ -e 's|@configure_input[@]|Generated from $@.in. DO NOT EDIT BY HAND!|' CLEANFILES = defs-static diff --git a/tests/defs b/tests/defs index f2c1ff7..44c670b 100644 --- a/tests/defs +++ b/tests/defs @@ -931,7 +931,7 @@ esac distdir=$me-1.0 # Set up the exit trap. -if test "$sh_errexit_works" = yes; then +# FIXME: adjust indentation, here and below. trap 'exit_status=$? set +e cd "$testbuilddir" @@ -994,7 +994,6 @@ if test "$sh_errexit_works" = yes; then # 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 -fi # Create and populate the temporary directory, if and as required. if test x"$am_create_testdir" = x"no"; then diff --git a/tests/defs-static.in b/tests/defs-static.in index e65285a..6727999 100644 --- a/tests/defs-static.in +++ b/tests/defs-static.in @@ -194,9 +194,6 @@ FGREP=${AM_TESTSUITE_FGREP-'@FGREP@'} # this variable. TEX=${AM_TESTSUITE_TEX-'@TEX@'} -# Whether $SHELL has working 'set -e' with exit trap. -sh_errexit_works='@sh_errexit_works@' - # The amount we should wait after modifying files depends on the platform. # For instance, Windows '95, '98 and ME have 2-second granularity # and can be up to 3 seconds in the future w.r.t. the system clock. diff --git a/tests/self-check-cleanup.tap b/tests/self-check-cleanup.tap index d7123bb..283206f 100755 --- a/tests/self-check-cleanup.tap +++ b/tests/self-check-cleanup.tap @@ -19,10 +19,6 @@ . ./defs || Exit 1 -if test x"$sh_errexit_works" != x"yes"; then - skip_all_ "$me: no working exit trap with 'set -e'" -fi - plan_ 42 # We still need a little hack to make ./defs work outside automake's diff --git a/tests/self-check-exit.tap b/tests/self-check-exit.tap index 6ae290d..ad40443 100755 --- a/tests/self-check-exit.tap +++ b/tests/self-check-exit.tap @@ -61,18 +61,7 @@ for sig in 1 2 13 15; do # Reset default SIGINT handler as portably as possible. trap 2 || trap - 2 fi - if test x"$sh_errexit_works" = x"yes"; then - # The exit trap should turn into an hard errors any failure - # caused by signals. - command_ok_ "kill -$sig" test $rc -eq 99 - else - # The exit trap is not installed, so that the shell should exit - # with status 128+n when receiving signal number n. But don't - # be too strict in the check, as POSIX only says that "The exit - # status of a command that terminated because it received a - # signal shall be reported as greater than 128". - command_ok_ "kill -$sig" test $rc -gt 128 - fi + command_ok_ "kill -$sig" test $rc -eq 99 unset rc done diff --git a/tests/self-check-explicit-skips.test b/tests/self-check-explicit-skips.test index 7766983..b984eb9 100755 --- a/tests/self-check-explicit-skips.test +++ b/tests/self-check-explicit-skips.test @@ -20,8 +20,6 @@ am_create_testdir=empty . ./defs || Exit 1 -test x"$sh_errexit_works" = x"yes" || skip_ "no working shell exit trap" - # We still need a little hack to make ./defs work outside automake's # tree `tests' subdirectory. Not a big deal. sed "s|^testbuilddir=.*|testbuilddir='`pwd`'|" ../defs-static >defs-static -- 1.7.2.3