Skip to content

Commit 2a01ef8

Browse files
peffgitster
authored andcommitted
test-lib: turn off "-x" tracing during chain-lint check
Now that GIT_TEST_CHAIN_LINT is on by default, running: ./t0000-basic.sh -x --verbose-only=1 starts with: expecting success: find .git/objects -type f -print >should-be-empty && test_line_count = 0 should-be-empty + exit 117 error: last command exited with $?=117 + find .git/objects -type f -print + test_line_count = 0 should-be-empty + test 3 != 3 + wc -l + test 0 = 0 ok 1 - .git/objects should be empty after git init in an empty repo This is confusing, as the "exit 117" line and the error line (which is printed in red, no less!) are not part of the test at all, but are rather in the separate chain-lint test_eval. Let's unset the "trace" variable when eval-ing the chain lint check, which avoids this. Note that we cannot just do a one-shot variable like: trace= test_eval ... as the behavior of one-shot variables for function calls is not portable. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 92b269f commit 2a01ef8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

t/test-lib.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,12 +532,17 @@ test_run_ () {
532532
expecting_failure=$2
533533

534534
if test "${GIT_TEST_CHAIN_LINT:-1}" != 0; then
535+
# turn off tracing for this test-eval, as it simply creates
536+
# confusing noise in the "-x" output
537+
trace_tmp=$trace
538+
trace=
535539
# 117 is magic because it is unlikely to match the exit
536540
# code of other programs
537541
test_eval_ "(exit 117) && $1"
538542
if test "$?" != 117; then
539543
error "bug in the test script: broken &&-chain: $1"
540544
fi
545+
trace=$trace_tmp
541546
fi
542547

543548
setup_malloc_check

0 commit comments

Comments
 (0)