577
;;
578
esac
579
580
-# Add libc MALLOC and MALLOC_PERTURB test only if we are not executing
581
-# the test with valgrind and have not compiled with conflict SANITIZE
582
-# options.
583
-if test -n "$valgrind" ||
584
- test -n "$SANITIZE_ADDRESS" ||
585
- test -n "$SANITIZE_LEAK" ||
586
- test -n "$TEST_NO_MALLOC_CHECK"
587
-then
588
- setup_malloc_check () {
589
- : nothing
590
- }
591
- teardown_malloc_check () {
592
- : nothing
593
- }
594
-else
595
- _USE_GLIBC_TUNABLES=
596
- _USE_GLIBC_PRELOAD=libc_malloc_debug.so.0
597
- if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
598
- _GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
599
- expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null &&
600
- stderr=$(LD_PRELOAD=$_USE_GLIBC_PRELOAD git version 2>&1 >/dev/null) &&
601
- test -z "$stderr"
602
- then
603
- _USE_GLIBC_TUNABLES=YesPlease
604
- fi
605
- setup_malloc_check () {
606
- local g
607
- local t
608
- MALLOC_CHECK_=3 MALLOC_PERTURB_=165
609
- export MALLOC_CHECK_ MALLOC_PERTURB_
610
- if test -n "$_USE_GLIBC_TUNABLES"
611
- then
612
- g=
613
- LD_PRELOAD=$_USE_GLIBC_PRELOAD
614
- for t in \
615
- glibc.malloc.check=1 \
616
- glibc.malloc.perturb=165
617
- do
618
- g="${g#:}:$t"
619
- done
620
- GLIBC_TUNABLES=$g
621
- export LD_PRELOAD GLIBC_TUNABLES
622
- fi
623
- }
624
- teardown_malloc_check () {
625
- unset MALLOC_CHECK_ MALLOC_PERTURB_
626
- unset LD_PRELOAD GLIBC_TUNABLES
627
- }
628
-fi
629
-
580
# Protect ourselves from common misconfiguration to export
581
# CDPATH into the environment
582
unset CDPATH
1436
GIT_CEILING_DIRECTORIES="$TRASH_DIRECTORY/.."
1437
export PATH GIT_EXEC_PATH GIT_TEMPLATE_DIR GIT_CONFIG_NOSYSTEM GIT_ATTR_NOSYSTEM GIT_CEILING_DIRECTORIES
1438
1439
+# Add libc MALLOC and MALLOC_PERTURB test only if we are not executing
1440
+# the test with valgrind and have not compiled with conflict SANITIZE
1441
+# options.
1442
+if test -n "$valgrind" ||
1443
+ test -n "$SANITIZE_ADDRESS" ||
1444
+ test -n "$SANITIZE_LEAK" ||
1445
+ test -n "$TEST_NO_MALLOC_CHECK"
1446
+then
1447
+ setup_malloc_check () {
1448
+ : nothing
1449
+ }
1450
+ teardown_malloc_check () {
1451
+ : nothing
1452
+ }
1453
+else
1454
+ _USE_GLIBC_TUNABLES=
1455
+ _USE_GLIBC_PRELOAD=libc_malloc_debug.so.0
1456
+ if _GLIBC_VERSION=$(getconf GNU_LIBC_VERSION 2>/dev/null) &&
1457
+ _GLIBC_VERSION=${_GLIBC_VERSION#"glibc "} &&
1458
+ expr 2.34 \<= "$_GLIBC_VERSION" >/dev/null &&
1459
+ stderr=$(LD_PRELOAD=$_USE_GLIBC_PRELOAD git version 2>&1 >/dev/null) &&
1460
+ test -z "$stderr"
1461
+ then
1462
+ _USE_GLIBC_TUNABLES=YesPlease
1463
+ fi
1464
+ setup_malloc_check () {
1465
+ local g
1466
+ local t
1467
+ MALLOC_CHECK_=3 MALLOC_PERTURB_=165
1468
+ export MALLOC_CHECK_ MALLOC_PERTURB_
1469
+ if test -n "$_USE_GLIBC_TUNABLES"
1470
+ then
1471
+ g=
1472
+ LD_PRELOAD=$_USE_GLIBC_PRELOAD
1473
+ for t in \
1474
+ glibc.malloc.check=1 \
1475
+ glibc.malloc.perturb=165
1476
+ do
1477
+ g="${g#:}:$t"
1478
+ done
1479
+ GLIBC_TUNABLES=$g
1480
+ export LD_PRELOAD GLIBC_TUNABLES
1481
+ fi
1482
+ }
1483
+ teardown_malloc_check () {
1484
+ unset MALLOC_CHECK_ MALLOC_PERTURB_
1485
+ unset LD_PRELOAD GLIBC_TUNABLES
1486
+ }
1487
+fi
1488
+
1489
if test -z "$GIT_TEST_CMP"
1490
then
1491
if test -n "$GIT_TEST_CMP_USE_COPIED_CONTEXT"