aboutsummaryrefslogtreecommitdiffstats
path: root/t/test-lib.sh
diff options
context:
space:
mode:
Diffstat (limited to 't/test-lib.sh')
-rw-r--r--t/test-lib.sh78
1 files changed, 49 insertions, 29 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index d1f62adbf8..af722d383d 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -499,24 +499,20 @@ EDITOR=:
# /usr/xpg4/bin/sh and /bin/ksh to bail out. So keep the unsets
# deriving from the command substitution clustered with the other
# ones.
-unset VISUAL EMAIL LANGUAGE $("$PERL_PATH" -e '
- my @env = keys %ENV;
- my $ok = join("|", qw(
- TRACE
- DEBUG
- TEST
- .*_TEST
- PROVE
- VALGRIND
- UNZIP
- PERF_
- CURL_VERBOSE
- TRACE_CURL
- BUILD_DIR
- ));
- my @vars = grep(/^GIT_/ && !/^GIT_($ok)/o, @env);
- print join("\n", @vars);
-')
+unset VISUAL EMAIL LANGUAGE $(env | sed -n \
+ -e '/^GIT_TRACE/d' \
+ -e '/^GIT_DEBUG/d' \
+ -e '/^GIT_TEST/d' \
+ -e '/^GIT_.*_TEST/d' \
+ -e '/^GIT_PROVE/d' \
+ -e '/^GIT_VALGRIND/d' \
+ -e '/^GIT_UNZIP/d' \
+ -e '/^GIT_PERF_/d' \
+ -e '/^GIT_CURL_VERBOSE/d' \
+ -e '/^GIT_TRACE_CURL/d' \
+ -e '/^GIT_BUILD_DIR/d' \
+ -e 's/^\(GIT_[^=]*\)=.*/\1/p'
+)
unset XDG_CACHE_HOME
unset XDG_CONFIG_HOME
unset GITPERLLIB
@@ -544,8 +540,6 @@ GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-sha1}"
export GIT_DEFAULT_HASH
GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
export GIT_DEFAULT_REF_FORMAT
-GIT_TEST_MERGE_ALGORITHM="${GIT_TEST_MERGE_ALGORITHM:-ort}"
-export GIT_TEST_MERGE_ALGORITHM
# Tests using GIT_TRACE typically don't want <timestamp> <file>:<line> output
GIT_TRACE_BARE=1
@@ -1169,20 +1163,20 @@ test_atexit_handler () {
teardown_malloc_check
}
-check_test_results_san_file_empty_ () {
- test -z "$TEST_RESULTS_SAN_FILE" && return 0
+check_test_results_san_file_has_entries_ () {
+ test -z "$TEST_RESULTS_SAN_FILE" && return 1
- # stderr piped to /dev/null because the directory may have
- # been "rmdir"'d already.
- ! find "$TEST_RESULTS_SAN_DIR" \
- -type f \
- -name "$TEST_RESULTS_SAN_FILE_PFX.*" 2>/dev/null |
- xargs grep ^DEDUP_TOKEN |
+ # Lines marked with DEDUP_TOKEN show unique leaks. We only care that we
+ # found at least one.
+ #
+ # But also suppress any false positives caused by bugs or races in the
+ # sanitizer itself.
+ grep -s ^DEDUP_TOKEN "$TEST_RESULTS_SAN_FILE".* |
grep -qv sanitizer::GetThreadStackTopAndBottom
}
check_test_results_san_file_ () {
- if check_test_results_san_file_empty_
+ if ! check_test_results_san_file_has_entries_
then
return
fi &&
@@ -1523,6 +1517,22 @@ then
export LSAN_OPTIONS
fi
+if test -z "$PERL_PATH"
+then
+ case "${GIT_TEST_CHAIN_LINT:-unset}" in
+ unset)
+ GIT_TEST_CHAIN_LINT=0
+ ;;
+ 0)
+ # The user has explicitly disabled the chain linter, so we
+ # don't have anything to worry about.
+ ;;
+ *)
+ BAIL_OUT 'You need Perl for the chain linter'
+ ;;
+ esac
+fi
+
if test "${GIT_TEST_CHAIN_LINT:-1}" != 0 &&
test "${GIT_TEST_EXT_CHAIN_LINT:-1}" != 0
then
@@ -1694,6 +1704,7 @@ test -n "$USE_LIBPCRE2" && test_set_prereq LIBPCRE2
test -z "$NO_GETTEXT" && test_set_prereq GETTEXT
test -n "$SANITIZE_LEAK" && test_set_prereq SANITIZE_LEAK
test -n "$GIT_VALGRIND_ENABLED" && test_set_prereq VALGRIND
+test -n "$PERL_PATH" && test_set_prereq PERL_TEST_HELPERS
if test -z "$GIT_TEST_CHECK_CACHE_TREE"
then
@@ -1862,6 +1873,15 @@ test_lazy_prereq CURL '
curl --version
'
+test_lazy_prereq WITH_BREAKING_CHANGES '
+ test -n "$WITH_BREAKING_CHANGES"
+'
+
+test_lazy_prereq WITHOUT_BREAKING_CHANGES '
+ # Signal that this prereq should not be used.
+ exit 125
+'
+
# SHA1 is a test if the hash algorithm in use is SHA-1. This is both for tests
# which will not work with other hash algorithms and tests that work but don't
# test anything meaningful (e.g. special values which cause short collisions).