Re: [coreutils] [PATCH] tests: set fail=0 by default
On 12/17/2010 11:55 PM, Jim Meyering wrote: This change probably belongs in gnulib's tests/init.sh, too. OK, I installed the following (slightly different) version of the change into gnulib. Next I'll propagate the latest gnulib version of init.sh into coreutils. diff --git a/ChangeLog b/ChangeLog index 8b02175..1ee355c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-12-18 Paul Eggert egg...@cs.ucla.edu + + tests: set fail=0 at start + * tests/init.sh (setup_): Move fail=0 initialization here ... + (mktempd_): ... from here, so that tests can rely on fail being + set to 0 initially. This fixes a problem in coreutils; see: + http://lists.gnu.org/archive/html/coreutils/2010-12/msg00083.html + 2010-12-18 Bruno Haible br...@clisp.org memmem-simple: Stylistic changes. diff --git a/tests/init.sh b/tests/init.sh index 14f3b19..4d89a1a 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -324,6 +324,7 @@ setup_() fi initial_cwd_=$PWD + fail=0 pfx_=`testdir_prefix_` test_dir_=`mktempd_ $initial_cwd_ $pfx_-$ME_.` \ @@ -416,8 +417,6 @@ mktempd_() *) fail_ invalid template: $template_ (must have a suffix of at least 4 X's);; esac - fail=0 - # First, try to use mktemp. d=`unset TMPDIR; mktemp -d -t -p $destdir_ $template_ 2/dev/null` \ || fail=1 -- 1.7.2
Re: [coreutils] [PATCH] tests: set fail=0 by default
Paul Eggert wrote: I found this one by tracking down a bug with the latest snapshot on Solaris. Still haven't got to the real bug yet, but this bug was getting in the way. Subject: [PATCH] tests: set fail=0 by default * tests/init.sh (setup_): Set fail=0. This was the intent as per http://lists.gnu.org/archive/html/bug-coreutils/2010-12/msg00058.html but the assignment in mktempd_ is ineffective, since mktempd_ is used inside `` and its assignments are in a subshell. --- tests/init.sh |3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/tests/init.sh b/tests/init.sh index a57de77..7be5e9e 100644 --- a/tests/init.sh +++ b/tests/init.sh @@ -336,6 +336,9 @@ setup_() for sig_ in 1 2 3 13 15; do eval trap 'Exit $(expr $sig_ + 128)' $sig_ done + + # Set up for the Exit $fail at the end of many tests. + fail=0 Thanks for spotting and fixing that. This is a new bug. test-lib.sh had a working fail=0 initialization since Oct 30: tests: factor 350 fail=0 initializations into test-lib.sh http://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=3c88587b2eadee1 but then I converted all bourne shell test scripts to use init.sh rather than the aging test-lib.sh, and init.sh did not have that initialization. This change probably belongs in gnulib's tests/init.sh, too.