summaryrefslogtreecommitdiff
path: root/t/test-lib.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh43
1 files changed, 39 insertions, 4 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 2679a7596a..0f7a137c7d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -476,6 +476,13 @@ export GIT_TEST_MERGE_ALGORITHM
GIT_TRACE_BARE=1
export GIT_TRACE_BARE
+# Some tests scan the GIT_TRACE2_EVENT feed for events, but the
+# default depth is 2, which frequently causes issues when the
+# events are wrapped in new regions. Set it to a sufficiently
+# large depth to avoid custom changes in the test suite.
+GIT_TRACE2_EVENT_NESTING=100
+export GIT_TRACE2_EVENT_NESTING
+
# Use specific version of the index file format
if test -n "${GIT_TEST_INDEX_VERSION:+isset}"
then
@@ -489,6 +496,13 @@ then
export GIT_PERL_FATAL_WARNINGS
fi
+case $GIT_TEST_FSYNC in
+'')
+ GIT_TEST_FSYNC=0
+ export GIT_TEST_FSYNC
+ ;;
+esac
+
# Add libc MALLOC and MALLOC_PERTURB test
# only if we are not executing the test with valgrind
if test -n "$valgrind" ||
@@ -589,6 +603,15 @@ USER_TERM="$TERM"
TERM=dumb
export TERM USER_TERM
+# What is written by tests to stdout and stderr is sent to different places
+# depending on the test mode (e.g. /dev/null in non-verbose mode, piped to tee
+# with --tee option, etc.). We save the original stdin to FD #6 and stdout and
+# stderr to #5 and #7, so that the test framework can use them (e.g. for
+# printing errors within the test framework) independently of the test mode.
+exec 5>&1
+exec 6<&0
+exec 7>&2
+
_error_exit () {
finalize_junit_xml
GIT_EXIT_OK=t
@@ -612,7 +635,7 @@ BAIL_OUT () {
local bail_out="Bail out! "
local message="$1"
- say_color error $bail_out "$message"
+ say_color >&5 error $bail_out "$message"
_error_exit
}
@@ -637,9 +660,6 @@ then
exit 0
fi
-exec 5>&1
-exec 6<&0
-exec 7>&2
if test "$verbose_log" = "t"
then
exec 3>>"$GIT_TEST_TEE_OUTPUT_FILE" 4>&3
@@ -669,6 +689,8 @@ test_fixed=0
test_broken=0
test_success=0
+test_missing_prereq=
+
test_external_has_tap=0
die () {
@@ -1069,6 +1091,14 @@ test_skip () {
of_prereq=" of $test_prereq"
fi
skipped_reason="missing $missing_prereq${of_prereq}"
+
+ # Keep a list of all the missing prereq for result aggregation
+ if test -z "$missing_prereq"
+ then
+ test_missing_prereq=$missing_prereq
+ else
+ test_missing_prereq="$test_missing_prereq,$missing_prereq"
+ fi
fi
case "$to_skip" in
@@ -1175,6 +1205,7 @@ test_done () {
fixed $test_fixed
broken $test_broken
failed $test_failure
+ missing_prereq $test_missing_prereq
EOF
fi
@@ -1734,6 +1765,10 @@ build_option () {
sed -ne "s/^$1: //p"
}
+test_lazy_prereq SIZE_T_IS_64BIT '
+ test 8 -eq "$(build_option sizeof-size_t)"
+'
+
test_lazy_prereq LONG_IS_64BIT '
test 8 -le "$(build_option sizeof-long)"
'