changeset 13332:360961713a01

init.sh: enable MALLOC_PERTURB_ * tests/init.sh: Enable glibc's malloc-perturbing option.
author Jim Meyering <meyering@redhat.com>
date Sun, 09 May 2010 22:39:34 +0200
parents dc2c7e3048ec
children dd75a1afe536
files ChangeLog tests/init.sh
diffstat 2 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,9 @@
 
 2010-05-09  Jim Meyering  <meyering@redhat.com>
 
+	init.sh: enable MALLOC_PERTURB_
+	* tests/init.sh: Enable glibc's malloc-perturbing option.
+
 	maint.mk: improve sc_cross_check_PATH_usage_in_tests
 	With my recent change in init.sh from the two-line form:
 	    -#   : ${srcdir=.}
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -94,6 +94,13 @@
 
 test -n "$EXEEXT" && shopt -s expand_aliases
 
+# Enable glibc's malloc-perturbing option.
+# This is cheap and useful for exposing code that depends on the fact that
+# malloc-related functions often return memory that is mostly zeroed.
+# If you have the time and cycles, use valgrind to do an even better job.
+${MALLOC_PERTURB_=87}
+export MALLOC_PERTURB_
+
 # We use a trap below for cleanup.  This requires us to go through
 # hoops to get the right exit status transported through the handler.
 # So use `Exit STATUS' instead of `exit STATUS' inside of the tests.