diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-21 15:14:23 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-21 15:14:23 -0700 |
commit | b6763af74ba55570deae38ce118c1d803d7b825c (patch) | |
tree | 6201d4889211ee5ff35d298064e615a1f7a92775 /t | |
parent | Merge branch 'sm/no-git-in-upstream-of-pipe-in-tests' (diff) | |
parent | test-lib: declare local variables as local (diff) | |
download | tgif-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.sh | 18 |
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 |