changeset 14203:13950a70790f

test-malloca: unset MALLOC_PERTURB_ to speed up test * tests/test-malloca.c (main): Unset the environment variable to greatly speed up the test. * tests/init.sh: Don't say that MALLOC_PERTURB_ is cheap. * modules/malloca-tests: Depend on unsetenv.
author Pádraig Brady <P@draigBrady.com>
date Fri, 21 Jan 2011 08:47:51 +0000
parents 15ab1c22a3aa
children 2620b4196c48
files ChangeLog modules/malloca-tests tests/init.sh tests/test-malloca.c
diffstat 4 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-21  Pádraig Brady <P@draigBrady.com>
+
+	malloca-tests: make faster by unsetting MALLOC_PERTURB_
+	* tests/test-malloca.c (main): Unset the environment variable
+	to greatly speed up the test.
+	* tests/init.sh: Don't say that MALLOC_PERTURB_ is cheap.
+	* modules/malloca-tests: Depend on unsetenv.
+
 2011-01-21  Pádraig Brady <P@draigBrady.com>
 
 	ignore-value: remove stdint dependency
--- a/modules/malloca-tests
+++ b/modules/malloca-tests
@@ -2,6 +2,7 @@
 tests/test-malloca.c
 
 Depends-on:
+unsetenv
 
 configure.ac:
 
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -193,7 +193,7 @@
 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
+# This is 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}
--- a/tests/test-malloca.c
+++ b/tests/test-malloca.c
@@ -37,6 +37,9 @@
 {
   int i;
 
+  /* This slows down malloc a lot.  */
+  unsetenv ("MALLOC_PERTURB_");
+
   /* Repeat a lot of times, to make sure there's no memory leak.  */
   for (i = 0; i < 50000; i++)
     {