From: Junio C Hamano Date: Tue, 6 Mar 2018 23:11:48 +0000 (-0800) Subject: Merge branch 'sg/test-x' into next X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/ab0684b27c1f6883f77a68734c6fa3459b521807 Merge branch 'sg/test-x' into next Running test scripts under -x option of the shell is often not a useful way to debug them, because the error messages from the commands tests try to capture and inspect are contaminated by the tracing output by the shell. An earlier work done to make it more pleasant to run tests under -x with recent versions of bash is extended to cover posix shells that do not support BASH_XTRACEFD. * sg/test-x: travis-ci: run tests with '-x' tracing t/README: add a note about don't saving stderr of compound commands t1510-repo-setup: mark as untraceable with '-x' t9903-bash-prompt: don't check the stderr of __git_ps1() t5570-git-daemon: don't check the stderr of a subshell t5526: use $TRASH_DIRECTORY to specify the path of GIT_TRACE log file t5500-fetch-pack: don't check the stderr of a subshell t3030-merge-recursive: don't check the stderr of a subshell t1507-rev-parse-upstream: don't check the stderr of a shell function t: add means to disable '-x' tracing for individual test scripts t: prevent '-x' tracing from interfering with test helpers' stderr --- ab0684b27c1f6883f77a68734c6fa3459b521807 diff --cc t/test-lib-functions.sh index 6e342804f9,37eb34044a..b895366fee --- a/t/test-lib-functions.sh +++ b/t/test-lib-functions.sh @@@ -664,12 -656,10 +664,12 @@@ test_must_fail () # # Writing "git config --unset all.configuration || :" would be wrong, # because we want to notice if it fails due to segv. +# +# Accepts the same options as test_must_fail. test_might_fail () { - test_must_fail ok=success "$@" - } + test_must_fail ok=success "$@" 2>&7 + } 7>&2 2>&4 # Similar to test_must_fail and test_might_fail, but check that a # given command exited with a given exit code. Meant to be used as: @@@ -688,9 -678,9 +688,9 @@@ test_expect_code () return 0 fi - echo >&2 "test_expect_code: command exited with $exit_code, we wanted $want_code $*" + echo >&4 "test_expect_code: command exited with $exit_code, we wanted $want_code $*" return 1 - } + } 7>&2 2>&4 # test_cmp is a helper function to compare actual and expected output. # You can use it like: