Skip to content

Commit 7d0a1c8

Browse files
committed
Merge branch 'pw/use-glibc-tunable-for-malloc-optim'
Avoid repeatedly running getconf to ask libc version in the test suite, and instead just as it once per script. * pw/use-glibc-tunable-for-malloc-optim: tests: cache glibc version check
2 parents c0f6dd4 + a6a58f7 commit 7d0a1c8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

t/test-lib.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,19 @@ then
575575
: nothing
576576
}
577577
else
578+
_USE_GLIBC_TUNABLES=
579+
if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
580+
_GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
581+
expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null
582+
then
583+
_USE_GLIBC_TUNABLES=YesPlease
584+
fi
578585
setup_malloc_check () {
579586
local g
580587
local t
581588
MALLOC_CHECK_=3 MALLOC_PERTURB_=165
582589
export MALLOC_CHECK_ MALLOC_PERTURB_
583-
if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
584-
_GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
585-
expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null
590+
if test -n "$_USE_GLIBC_TUNABLES"
586591
then
587592
g=
588593
LD_PRELOAD="libc_malloc_debug.so.0"

0 commit comments

Comments
 (0)