summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-09-25 17:40:14 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-09-25 17:40:15 (GMT)
commit0ec6aa567a2ad94960ad71e35d814d5abda027f3 (patch)
tree852e2c05e38a731eea403d64c43f8884a34a0540 /t
parentc4eed8689b635e4c27759479afd656ea770607b7 (diff)
parent1b3185fc2be3cc92a834fcfcb7110d1072184700 (diff)
downloadgit-0ec6aa567a2ad94960ad71e35d814d5abda027f3.zip
git-0ec6aa567a2ad94960ad71e35d814d5abda027f3.tar.gz
git-0ec6aa567a2ad94960ad71e35d814d5abda027f3.tar.bz2
Merge branch 'ep/malloc-check-perturb'
Run our test scripts with MALLOC_CHECK_ and MALLOC_PERTURB_, the built-in memory access checking facility GNU libc has. * ep/malloc-check-perturb: MALLOC_CHECK: various clean-ups Add MALLOC_CHECK_ and MALLOC_PERTURB_ libc env to the test suite for detecting heap corruption
Diffstat (limited to 't')
-rw-r--r--t/perf/perf-lib.sh1
-rw-r--r--t/test-lib.sh23
2 files changed, 24 insertions, 0 deletions
diff --git a/t/perf/perf-lib.sh b/t/perf/perf-lib.sh
index a1361e5..1d0bb9d 100644
--- a/t/perf/perf-lib.sh
+++ b/t/perf/perf-lib.sh
@@ -42,6 +42,7 @@ else
fi
TEST_NO_CREATE_REPO=t
+TEST_NO_MALLOC_=t
. ../test-lib.sh
diff --git a/t/test-lib.sh b/t/test-lib.sh
index f8e3733..aad4606 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -93,6 +93,27 @@ export GIT_AUTHOR_EMAIL GIT_AUTHOR_NAME
export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
export EDITOR
+# Add libc MALLOC and MALLOC_PERTURB test
+# only if we are not executing the test with valgrind
+if expr " $GIT_TEST_OPTS " : ".* --valgrind " >/dev/null ||
+ test -n "TEST_NO_MALLOC_"
+then
+ setup_malloc_check () {
+ : nothing
+ }
+ teardown_malloc_check () {
+ : nothing
+ }
+else
+ setup_malloc_check () {
+ MALLOC_CHECK_=3 MALLOC_PERTURB_=165
+ export MALLOC_CHECK_ MALLOC_PERTURB_
+ }
+ teardown_malloc_check () {
+ unset MALLOC_CHECK_ MALLOC_PERTURB_
+ }
+fi
+
# Protect ourselves from common misconfiguration to export
# CDPATH into the environment
unset CDPATH
@@ -302,7 +323,9 @@ test_run_ () {
if test -z "$immediate" || test $eval_ret = 0 || test -n "$expecting_failure"
then
+ setup_malloc_check
test_eval_ "$test_cleanup"
+ teardown_malloc_check
fi
if test "$verbose" = "t" && test -n "$HARNESS_ACTIVE"
then