bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] test-malloca: unset MALLOC_PERTURB_ to speed up test


From: Pádraig Brady
Subject: [PATCH] test-malloca: unset MALLOC_PERTURB_ to speed up test
Date: Fri, 21 Jan 2011 09:50:59 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.8) Gecko/20100227 Thunderbird/3.0.3

commit a00e384e1d7bbf0d4961b6f355307fd78b7536dd
Author: Pádraig Brady <address@hidden>
Date:   Fri Jan 21 08:47:51 2011 +0000

    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.

diff --git a/ChangeLog b/ChangeLog
index 1afdc08..dcd261d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-01-21  Pádraig Brady <address@hidden>
+
+       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-07  Pádraig Brady <address@hidden>

        ignore-value: fixup comments, and add Eric Blake
diff --git a/modules/malloca-tests b/modules/malloca-tests
index c473b35..57cd1bc 100644
--- a/modules/malloca-tests
+++ b/modules/malloca-tests
@@ -2,6 +2,7 @@ Files:
 tests/test-malloca.c

 Depends-on:
+unsetenv

 configure.ac:

diff --git a/tests/init.sh b/tests/init.sh
index 44be35b..fb1e026 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -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}
diff --git a/tests/test-malloca.c b/tests/test-malloca.c
index 0dce83a..92c86f2 100644
--- a/tests/test-malloca.c
+++ b/tests/test-malloca.c
@@ -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++)
     {



reply via email to

[Prev in Thread] Current Thread [Next in Thread]