Merge branch 'sg/test-x'
authorJunio C Hamano <gitster@pobox.com>
Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 14 Mar 2018 19:01:03 +0000 (12:01 -0700)
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

1  2 
t/README
t/t5526-fetch-submodules.sh
t/test-lib-functions.sh
t/test-lib.sh
diff --cc t/README
Simple merge
Simple merge
index 6e342804f96fb62ff0b3cfaf667e7efce79dc6af,37eb34044ab5794d46b4363a1d04dc9445279e2a..b895366feef6027ac00bf47271b2530e8b7e7162
@@@ -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:
diff --cc t/test-lib.sh
Simple merge