From d5d1928563ca79cec327bd7f1c80239e95c1b289 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 12 Jun 2008 01:12:11 +0200 Subject: [PATCH] Avoid a test failure when the test wants to skip itself. --- ChangeLog | 6 ++++++ tests/test-vc-list-files-cvs.sh | 3 ++- tests/test-vc-list-files-git.sh | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8d5771dced..0e6fdf69b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-06-10 Bruno Haible + + * tests/test-vc-list-files-git.sh: Make double use of 'exit'. Needed + for $? to work inside the trap command, with various /bin/sh-s. + * tests/test-vc-list-files-cvs.sh: Likewise. + 2008-06-10 Bruno Haible * lib/acl-internal.h: Don't include gettext.h here. diff --git a/tests/test-vc-list-files-cvs.sh b/tests/test-vc-list-files-cvs.sh index c94932fc27..c87267cde3 100755 --- a/tests/test-vc-list-files-cvs.sh +++ b/tests/test-vc-list-files-cvs.sh @@ -44,7 +44,8 @@ for i in with-cvsu without; do ok=0 mkdir $tmpdir && cd $tmpdir && # without cvs, skip the test - { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 || exit 77; } && + # The double use of 'exit' is needed for the reference to $? inside the trap. + { ( cvs -Q -d "$repo" init ) > /dev/null 2>&1 || { (exit 77); exit 77; }; } && mkdir w && cd w && mkdir d && touch d/a b c && diff --git a/tests/test-vc-list-files-git.sh b/tests/test-vc-list-files-git.sh index 3a669dd0e3..ac50971db1 100755 --- a/tests/test-vc-list-files-git.sh +++ b/tests/test-vc-list-files-git.sh @@ -31,7 +31,8 @@ trap '(exit $?); exit $?' 1 2 13 15 fail=1 mkdir $tmpdir && cd $tmpdir && # without git, skip the test - { ( git init -q ) > /dev/null 2>&1 || exit 77; } && + # The double use of 'exit' is needed for the reference to $? inside the trap. + { ( git init -q ) > /dev/null 2>&1 || { (exit 77); exit 77; }; } && mkdir d && touch d/a b c && git add . > /dev/null && -- 2.30.2