Skip to content

Commit 84deb3e

Browse files
committed
Merge branch 'jk/test-with-x' into maint
Running tests with the "-x" option to make them verbose had some unpleasant interactions with other features of the test suite. * jk/test-with-x: test-lib: disable trace when test is not verbose test-lib: turn off "-x" tracing during chain-lint check
2 parents 7a23807 + 9b5fe78 commit 84deb3e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

t/test-lib.sh

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -531,14 +531,18 @@ maybe_setup_valgrind () {
531531
fi
532532
}
533533

534+
want_trace () {
535+
test "$trace" = t && test "$verbose" = t
536+
}
537+
534538
# This is a separate function because some tests use
535539
# "return" to end a test_expect_success block early
536540
# (and we want to make sure we run any cleanup like
537541
# "set +x").
538542
test_eval_inner_ () {
539543
# Do not add anything extra (including LF) after '$*'
540544
eval "
541-
test \"$trace\" = t && set -x
545+
want_trace && set -x
542546
$*"
543547
}
544548

@@ -554,7 +558,7 @@ test_eval_ () {
554558
{
555559
test_eval_inner_ "$@" </dev/null >&3 2>&4
556560
test_eval_ret_=$?
557-
if test "$trace" = t
561+
if want_trace
558562
then
559563
set +x
560564
if test "$test_eval_ret_" != 0
@@ -571,12 +575,17 @@ test_run_ () {
571575
expecting_failure=$2
572576

573577
if test "${GIT_TEST_CHAIN_LINT:-1}" != 0; then
578+
# turn off tracing for this test-eval, as it simply creates
579+
# confusing noise in the "-x" output
580+
trace_tmp=$trace
581+
trace=
574582
# 117 is magic because it is unlikely to match the exit
575583
# code of other programs
576584
test_eval_ "(exit 117) && $1"
577585
if test "$?" != 117; then
578586
error "bug in the test script: broken &&-chain: $1"
579587
fi
588+
trace=$trace_tmp
580589
fi
581590

582591
setup_malloc_check

0 commit comments

Comments
 (0)