summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2015-08-25 16:09:16 -0700
committerJunio C Hamano <gitster@pobox.com>2015-08-25 16:09:16 -0700
commit84deb3eac542cee2542e48de31c66383fbe3fc8d (patch)
tree51230343581215e7e3097f8d65083db418141ece
parent7a23807407a2da88929bbeb826ac5030ee8285ca (diff)
parent9b5fe78b343d2416e5c6da28fa80303957aec371 (diff)
downloadgit-84deb3eac542cee2542e48de31c66383fbe3fc8d.tar.gz
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
-rw-r--r--t/test-lib.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index cea6cda604..16c4d7b516 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -531,6 +531,10 @@ maybe_setup_valgrind () {
fi
}
+want_trace () {
+ test "$trace" = t && test "$verbose" = t
+}
+
# This is a separate function because some tests use
# "return" to end a test_expect_success block early
# (and we want to make sure we run any cleanup like
@@ -538,7 +542,7 @@ maybe_setup_valgrind () {
test_eval_inner_ () {
# Do not add anything extra (including LF) after '$*'
eval "
- test \"$trace\" = t && set -x
+ want_trace && set -x
$*"
}
@@ -554,7 +558,7 @@ test_eval_ () {
{
test_eval_inner_ "$@" </dev/null >&3 2>&4
test_eval_ret_=$?
- if test "$trace" = t
+ if want_trace
then
set +x
if test "$test_eval_ret_" != 0
@@ -571,12 +575,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