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>

Pete Wyckoff committed Jun 27, 2012 at 08:01 UTC a0327c0edc7ada60ae2af5ec8daa5dcfcacd095d
1 file changed +7 -3
t/t9800-git-p4-basic.sh
+7 -3
@@ -134,9 +134,13 @@ test_expect_success 'exit when p4 fails to produce marshaled output' '
134 exit 1
135 EOF
136 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
144 '
145
146 test_expect_success 'clone bare' '