Skip to content

Commit 6283c1e

Browse files
committed
Merge branch 'pw/use-glibc-tunable-for-malloc-optim' into maint
Avoid repeatedly running getconf to ask libc version in the test suite, and instead just as it once per script. source: <[email protected]> * pw/use-glibc-tunable-for-malloc-optim: tests: cache glibc version check
2 parents 5825304 + a6a58f7 commit 6283c1e

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
@@ -557,14 +557,19 @@ then
557557
: nothing
558558
}
559559
else
560+
_USE_GLIBC_TUNABLES=
561+
if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
562+
_GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
563+
expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null
564+
then
565+
_USE_GLIBC_TUNABLES=YesPlease
566+
fi
560567
setup_malloc_check () {
561568
local g
562569
local t
563570
MALLOC_CHECK_=3 MALLOC_PERTURB_=165
564571
export MALLOC_CHECK_ MALLOC_PERTURB_
565-
if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
566-
_GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
567-
expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null
572+
if test -n "$_USE_GLIBC_TUNABLES"
568573
then
569574
g=
570575
LD_PRELOAD="libc_malloc_debug.so.0"

0 commit comments

Comments
 (0)