]> git.ipfire.org Git - thirdparty/git.git/commitdiff
test-lib: turn off "-x" tracing during chain-lint check
authorJeff King <peff@peff.net>
Thu, 6 Aug 2015 05:31:47 +0000 (01:31 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 7 Aug 2015 18:50:28 +0000 (11:50 -0700)
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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh

index 281c1eca0925664a1bddec0e2edca017f68a1a47..bc20185b51ba85db9f12659096b5ca859206ca35 100644 (file)
@@ -532,12 +532,17 @@ test_run_ () {
        expecting_failure=$2
 
        if test "${GIT_TEST_CHAIN_LINT:-1}" != 0; then
+               # turn off tracing for this test-eval, as it simply creates
+               # confusing noise in the "-x" output
+               trace_tmp=$trace
+               trace=
                # 117 is magic because it is unlikely to match the exit
                # code of other programs
                test_eval_ "(exit 117) && $1"
                if test "$?" != 117; then
                        error "bug in the test script: broken &&-chain: $1"
                fi
+               trace=$trace_tmp
        fi
 
        setup_malloc_check