summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2022-03-21 15:14:23 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2022-03-21 15:14:23 -0700
commitb6763af74ba55570deae38ce118c1d803d7b825c (patch)
tree6201d4889211ee5ff35d298064e615a1f7a92775 /t
parentMerge branch 'sm/no-git-in-upstream-of-pipe-in-tests' (diff)
parenttest-lib: declare local variables as local (diff)
downloadtgif-b6763af74ba55570deae38ce118c1d803d7b825c.tar.xz
Merge branch 'ep/test-malloc-check-with-glibc-2.34'
The method to trigger malloc check used in our tests no longer work with newer versions of glibc. * ep/test-malloc-check-with-glibc-2.34: test-lib: declare local variables as local test-lib.sh: Use GLIBC_TUNABLES instead of MALLOC_CHECK_ on glibc >= 2.34
Diffstat (limited to 't')
-rw-r--r--t/test-lib.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 9af5fb7674..515b1af7ed 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -548,11 +548,29 @@ then
}
else
setup_malloc_check () {
+ local g
+ local t
MALLOC_CHECK_=3 MALLOC_PERTURB_=165
export MALLOC_CHECK_ MALLOC_PERTURB_
+ if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
+ _GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
+ expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null
+ then
+ g=
+ LD_PRELOAD="libc_malloc_debug.so.0"
+ for t in \
+ glibc.malloc.check=1 \
+ glibc.malloc.perturb=165
+ do
+ g="${g#:}:$t"
+ done
+ GLIBC_TUNABLES=$g
+ export LD_PRELOAD GLIBC_TUNABLES
+ fi
}
teardown_malloc_check () {
unset MALLOC_CHECK_ MALLOC_PERTURB_
+ unset LD_PRELOAD GLIBC_TUNABLES
}
fi