Skip to content

Commit 302c2d6

Browse files
committed
t940?: make test "set -e" clean
In order to catch mistakes like misspelling "test_expect_success", we would like to eventually be able to run our test suite with the "-e" option on. The cverserver tests have the usual pattern, where it cmd ... if test $? ... expects cmd to be allowed to fail freely and we can act on its exit status, which is not possible under "set -e". Rewrite it using the common pattern: status=0; cmd ... || status=$? if test $status ... which means the same thing but does not fail under "set -e". Note that I do not run cvs tests myself, so while this change makes the scripts pass to the point where they correctly sets skip_all='message' and triggers test_done, it is very likely that there needs further work to make the rest of the scripts "set -e" clean. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 74060d4 commit 302c2d6

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

t/t9400-git-cvsserver-server.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ if ! test_have_prereq PERL; then
1717
skip_all='skipping git cvsserver tests, perl not available'
1818
test_done
1919
fi
20-
cvs >/dev/null 2>&1
21-
if test $? -ne 1
20+
status=0; cvs >/dev/null 2>&1 || status=$?
21+
if test $status -ne 1
2222
then
2323
skip_all='skipping git-cvsserver tests, cvs not found'
2424
test_done

t/t9401-git-cvsserver-crlf.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ check_status_options() {
6060
return $stat
6161
}
6262

63-
cvs >/dev/null 2>&1
64-
if test $? -ne 1
63+
status=0; cvs >/dev/null 2>&1 || status=$?
64+
if test $status -ne 1
6565
then
6666
skip_all='skipping git-cvsserver tests, cvs not found'
6767
test_done

t/t9402-git-cvsserver-refs.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ check_diff() {
6868

6969
#########
7070

71-
cvs >/dev/null 2>&1
72-
if test $? -ne 1
71+
status=0; cvs >/dev/null 2>&1 || status=$?
72+
if test $status -ne 1
7373
then
7474
skip_all='skipping git-cvsserver tests, cvs not found'
7575
test_done

0 commit comments

Comments
 (0)