t: use test_might_fail for diff and grep
Some tests run diff or grep to produce an output, and then compare the output to an expected value. We know the exit code we expect these processes to have (e.g., grep yields 0 if it produced output and 1 otherwise), so it would not make the test wrong to look for it. But the difference between their output and the expected output (e.g., shown by test_cmp) is much more useful to somebody debugging the test than the test just bailing out. These tests break the &&-chain to skip the exit-code check of the process. However, we can get the same effect by using test_might_fail. Note that in some cases the test did use "|| return 1", which meant the test was not wrong, but it did fool --chain-lint. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
a6a4a88af0
commit
35da1bf5d6
@ -75,8 +75,8 @@ test_expect_success \
|
|||||||
echo yomin >yomin &&
|
echo yomin >yomin &&
|
||||||
git update-index --add yomin &&
|
git update-index --add yomin &&
|
||||||
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
||||||
git ls-files --stage >4.out || return 1
|
git ls-files --stage >4.out &&
|
||||||
git diff -U0 --no-index M.out 4.out >4diff.out
|
test_might_fail git diff -U0 --no-index M.out 4.out >4diff.out &&
|
||||||
compare_change 4diff.out expected &&
|
compare_change 4diff.out expected &&
|
||||||
check_cache_at yomin clean &&
|
check_cache_at yomin clean &&
|
||||||
sum bozbar frotz nitfol >actual4.sum &&
|
sum bozbar frotz nitfol >actual4.sum &&
|
||||||
@ -94,8 +94,8 @@ test_expect_success \
|
|||||||
git update-index --add yomin &&
|
git update-index --add yomin &&
|
||||||
echo yomin yomin >yomin &&
|
echo yomin yomin >yomin &&
|
||||||
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
read_tree_u_must_succeed -m -u $treeH $treeM &&
|
||||||
git ls-files --stage >5.out || return 1
|
git ls-files --stage >5.out &&
|
||||||
git diff -U0 --no-index M.out 5.out >5diff.out
|
test_might_fail git diff -U0 --no-index M.out 5.out >5diff.out &&
|
||||||
compare_change 5diff.out expected &&
|
compare_change 5diff.out expected &&
|
||||||
check_cache_at yomin dirty &&
|
check_cache_at yomin dirty &&
|
||||||
sum bozbar frotz nitfol >actual5.sum &&
|
sum bozbar frotz nitfol >actual5.sum &&
|
||||||
|
@ -184,8 +184,8 @@ test_expect_success 'fetch can handle previously-fetched .idx files' '
|
|||||||
'
|
'
|
||||||
|
|
||||||
test_expect_success 'did not use upload-pack service' '
|
test_expect_success 'did not use upload-pack service' '
|
||||||
grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act
|
test_might_fail grep '/git-upload-pack' <"$HTTPD_ROOT_PATH"/access.log >act &&
|
||||||
: >exp
|
: >exp &&
|
||||||
test_cmp exp act
|
test_cmp exp act
|
||||||
'
|
'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user