diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-03-14 19:01:03 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-03-14 19:01:03 (GMT) |
commit | 571e472dc43f7b401b27cdcab5d43b0e66b9d203 (patch) | |
tree | 369c23ced6873dc52a430bd03372e439b3f8ec57 /t/README | |
parent | d92a0156607778422d54abef610ecbbf17ca9f12 (diff) | |
parent | aedffe9525084e3fcea251c8dd453c14deab6f4d (diff) | |
download | git-571e472dc43f7b401b27cdcab5d43b0e66b9d203.zip git-571e472dc43f7b401b27cdcab5d43b0e66b9d203.tar.gz git-571e472dc43f7b401b27cdcab5d43b0e66b9d203.tar.bz2 |
Merge branch 'sg/test-x'
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
Diffstat (limited to 't/README')
-rw-r--r-- | t/README | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -84,9 +84,10 @@ appropriately before running "make". -x:: Turn on shell tracing (i.e., `set -x`) during the tests - themselves. Implies `--verbose`. Note that in non-bash shells, - this can cause failures in some tests which redirect and test - the output of shell functions. Use with caution. + themselves. Implies `--verbose`. + Ignored in test scripts that set the variable 'test_untraceable' + to a non-empty value, unless it's run with a Bash version + supporting BASH_XTRACEFD, i.e. v4.1 or later. -d:: --debug:: @@ -452,6 +453,22 @@ Don't: causing the next test to start in an unexpected directory. Do so inside a subshell if necessary. + - save and verify the standard error of compound commands, i.e. group + commands, subshells, and shell functions (except test helper + functions like 'test_must_fail') like this: + + ( cd dir && git cmd ) 2>error && + test_cmp expect error + + When running the test with '-x' tracing, then the trace of commands + executed in the compound command will be included in standard error + as well, quite possibly throwing off the subsequent checks examining + the output. Instead, save only the relevant git command's standard + error: + + ( cd dir && git cmd 2>../error ) && + test_cmp expect error + - Break the TAP output The raw output from your test may be interpreted by a TAP harness. TAP |