diff options
author | Junio C Hamano <gitster@pobox.com> | 2022-03-21 22:14:23 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2022-03-21 22:14:23 (GMT) |
commit | b6763af74ba55570deae38ce118c1d803d7b825c (patch) | |
tree | 6201d4889211ee5ff35d298064e615a1f7a92775 /t | |
parent | 964a856cbea37a9b059f273aaed6925c95e4ee5d (diff) | |
parent | baedc5954348b30faa421333289b30818daf36c3 (diff) | |
download | git-b6763af74ba55570deae38ce118c1d803d7b825c.zip git-b6763af74ba55570deae38ce118c1d803d7b825c.tar.gz git-b6763af74ba55570deae38ce118c1d803d7b825c.tar.bz2 |
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 9af5fb7..515b1af 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 |