test-malloca: unset MALLOC_PERTURB_ to speed up test
authorPádraig Brady <P@draigBrady.com>
Fri, 21 Jan 2011 08:47:51 +0000 (08:47 +0000)
committerPádraig Brady <P@draigBrady.com>
Fri, 21 Jan 2011 11:40:16 +0000 (11:40 +0000)
* 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.

ChangeLog
modules/malloca-tests
tests/init.sh
tests/test-malloca.c

index 979502d05609871b7faa2a3c0b9e80da9786a49b..9bb96b85b078ffe841d0fbb1002ee00c8bdce223 100644 (file)
--- 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
index c473b35bfb481345882d103841b6941cc9c149d2..57cd1bce2358ead3ec9abfdfad38500b1ce0d445 100644 (file)
@@ -2,6 +2,7 @@ Files:
 tests/test-malloca.c
 
 Depends-on:
+unsetenv
 
 configure.ac:
 
index acb1ae541e83808279b263cbb99aa9b2fe84ae99..71c6516962a9da5ff159ea7fbd3f51261f6b94e3 100644 (file)
@@ -193,7 +193,7 @@ fi
 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}
index 0dce83aa667e4fea875aa8043e21afd169a78c2e..92c86f206c2f97db8dd08e2544032b0fe2a9b03d 100644 (file)
@@ -37,6 +37,9 @@ main ()
 {
   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++)
     {