Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2022-08-04 16:38:25 +0300
committerJunio C Hamano <gitster@pobox.com>2022-08-04 21:09:18 +0300
commita6a58f78015fd7f18e887a5e9682223a5b6408c8 (patch)
tree1da14e346e2c5f5d508ddf827a58edc2a1f0396d /t
parent00d12607a27e387ad78b5957afa05e89c87e83a5 (diff)
tests: cache glibc version check
131b94a10a ("test-lib.sh: Use GLIBC_TUNABLES instead of MALLOC_CHECK_ on glibc >= 2.34", 2022-03-04) introduced a check for the version of glibc that is in use. This check is performed as part of setup_malloc_check() which is called at least once for each test. As the test involves forking `getconf` and `expr` cache the result and use that within setup_malloc_check() to avoid forking these extra processes for each test. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rw-r--r--t/test-lib.sh11
1 files changed, 8 insertions, 3 deletions
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 8cabb4d10f..120f11812c 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -557,14 +557,19 @@ then
: nothing
}
else
+ _USE_GLIBC_TUNABLES=
+ if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
+ _GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
+ expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null
+ then
+ _USE_GLIBC_TUNABLES=YesPlease
+ fi
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
+ if test -n "$_USE_GLIBC_TUNABLES"
then
g=
LD_PRELOAD="libc_malloc_debug.so.0"