Skip to content

Commit a0327c0

Browse files
Pete Wyckoffgitster
authored andcommitted
git p4 test: fix badp4dir test
The construct used to get the return code was flawed, in that errors in the &&-chain before the semicolon were not caught. Use the standard test_expect_code instead. Set PATH in a subshell instead of relying on the bashism of setting it just for a single command. And fix the grep line so it doesn't worry about grep segfaults, and doesn't fail for i18n issues. Reported-by: Johannes Sixt <j.sixt@viscovery.net> Signed-off-by: Pete Wyckoff <pw@padd.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 9b6513a commit a0327c0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

t/t9800-git-p4-basic.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,9 +134,13 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
134134
exit 1
135135
EOF
136136
chmod 755 badp4dir/p4 &&
137-
PATH="$TRASH_DIRECTORY/badp4dir:$PATH" git p4 clone --dest="$git" //depot >errs 2>&1 ; retval=$? &&
138-
test $retval -eq 1 &&
139-
test_must_fail grep -q Traceback errs
137+
(
138+
PATH="$TRASH_DIRECTORY/badp4dir:$PATH" &&
139+
export PATH &&
140+
test_expect_code 1 git p4 clone --dest="$git" //depot >errs 2>&1
141+
) &&
142+
cat errs &&
143+
! test_i18ngrep Traceback errs
140144
'
141145

142146
test_expect_success 'clone bare' '

0 commit comments

Comments
 (0)