summaryrefslogtreecommitdiff
path: root/t/test-lib-functions.sh
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2018-03-14 19:01:03 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-03-14 19:01:03 (GMT)
commit571e472dc43f7b401b27cdcab5d43b0e66b9d203 (patch)
tree369c23ced6873dc52a430bd03372e439b3f8ec57 /t/test-lib-functions.sh
parentd92a0156607778422d54abef610ecbbf17ca9f12 (diff)
parentaedffe9525084e3fcea251c8dd453c14deab6f4d (diff)
downloadgit-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/test-lib-functions.sh')
-rw-r--r--t/test-lib-functions.sh24
1 files changed, 12 insertions, 12 deletions
diff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh
index 6e34280..b895366 100644
--- a/t/test-lib-functions.sh
+++ b/t/test-lib-functions.sh
@@ -629,7 +629,7 @@ test_must_fail () {
_test_ok=
;;
esac
- "$@"
+ "$@" 2>&7
exit_code=$?
if test $exit_code -eq 0 && ! list_contains "$_test_ok" success
then
@@ -652,7 +652,7 @@ test_must_fail () {
return 1
fi
return 0
-}
+} 7>&2 2>&4
# Similar to test_must_fail, but tolerates success, too. This is
# meant to be used in contexts like:
@@ -668,8 +668,8 @@ test_must_fail () {
# 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:
@@ -681,7 +681,7 @@ test_might_fail () {
test_expect_code () {
want_code=$1
shift
- "$@"
+ "$@" 2>&7
exit_code=$?
if test $exit_code = $want_code
then
@@ -690,7 +690,7 @@ test_expect_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:
@@ -896,8 +896,8 @@ test_write_lines () {
}
perl () {
- command "$PERL_PATH" "$@"
-}
+ command "$PERL_PATH" "$@" 2>&7
+} 7>&2 2>&4
# Is the value one of the various ways to spell a boolean true/false?
test_normalize_bool () {
@@ -1037,13 +1037,13 @@ test_env () {
shift
;;
*)
- "$@"
+ "$@" 2>&7
exit
;;
esac
done
)
-}
+} 7>&2 2>&4
# Returns true if the numeric exit code in "$2" represents the expected signal
# in "$1". Signals should be given numerically.
@@ -1085,9 +1085,9 @@ nongit () {
GIT_CEILING_DIRECTORIES=$(pwd) &&
export GIT_CEILING_DIRECTORIES &&
cd non-repo &&
- "$@"
+ "$@" 2>&7
)
-}
+} 7>&2 2>&4
# convert stdin to pktline representation; note that empty input becomes an
# empty packet, not a flush packet (for that you can just print 0000 yourself).