From 4f797ab76bdc21b4b9916c10f6fdce93c1c4b30c Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Tue, 13 Sep 2011 15:49:32 +0200 Subject: [PATCH] self tests: work around 'unset' spurious non-zero return value * tests/self-check-exit.tap ($init): Unset the possibly already unset variable `am_explicit_skips' when the `errexit' shell flag is not yet active, for the benefit of shell that return a non-zero status when unsetting an already-unset variable. --- ChangeLog | 8 ++++++++ tests/self-check-exit.tap | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 8c9615b6e..7b30dd99e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-09-13 Stefano Lattarini + + self tests: work around 'unset' spurious non-zero return value + * tests/self-check-exit.tap ($init): Unset the possibly already + unset variable `am_explicit_skips' when the `errexit' shell flag + is not yet active, for the benefit of shell that return a non-zero + status when unsetting an already-unset variable. + 2011-09-13 Stefano Lattarini tests: an explicative comment on signal-related woes diff --git a/tests/self-check-exit.tap b/tests/self-check-exit.tap index 5ac8b8f0e..9fe2905b0 100755 --- a/tests/self-check-exit.tap +++ b/tests/self-check-exit.tap @@ -31,7 +31,11 @@ set +e AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC -init='. ./defs; stderr_fileno_=2; unset am_explicit_skips' +# It's especially important that the `unset' is done before sourcing +# ./defs, i.e., when `set -e' is not active yet, for the benefit of shells +# (like Bash 2.05 and Solaris 10 /bin/ksh) that returns a non-zero status +# when unsetting an already-unset variable. +init='stderr_fileno_=2; unset am_explicit_skips; . ./defs' for st in 1 2 3 4 5 77 99 126 127 128 129 130 255; do for exit_cmd in "Exit $st" "sh -c 'exit $st'"; do -- 2.47.2