about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-08-02 17:01:02 +0200
committerTulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>2017-05-26 14:57:22 -0300
commit6d03be1cb5836205e5d1b14da71ff5579b161267 (patch)
tree018383463498313e9413d8fe90bce775d8c04cc5
parent3af49a0209bef32ba03b78ea3b7256584964d981 (diff)
downloadglibc-6d03be1cb5836205e5d1b14da71ff5579b161267.tar.gz
glibc-6d03be1cb5836205e5d1b14da71ff5579b161267.tar.xz
glibc-6d03be1cb5836205e5d1b14da71ff5579b161267.zip
malloc: Run tests without calling mallopt [BZ #19469]
The compiled tests no longer refer to the mallopt symbol
from their main functions.  (Some tests still call mallopt
explicitly, which is fine.)

(cherry picked from commit f690b56979dea81340a397c1b5e44827a6fb06e7)
-rw-r--r--ChangeLog7
-rw-r--r--malloc/Makefile4
-rw-r--r--test-skeleton.c2
3 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f257b2be82..32faf08e7d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-08-02  Florian Weimer  <fweimer@redhat.com>
+
+	[BZ #19469]
+	* malloc/Makefile (CPPFLAGS): Compile tests with
+	-DTEST_NO_MALLOPT.
+	* test-skeleton.c (main): Only call mallopt if !TEST_NO_MALLOPT.
+
 2017-01-05  Joseph Myers  <joseph@codesourcery.com>
 
 	[BZ #21026]
diff --git a/malloc/Makefile b/malloc/Makefile
index fa1730ecb7..4d5c81dce6 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -166,3 +166,7 @@ $(objpfx)libmemusage.so: $(libdl)
 
 # Extra dependencies
 $(foreach o,$(all-object-suffixes),$(objpfx)malloc$(o)): arena.c hooks.c
+
+# Compile the tests with a flag which suppresses the mallopt call in
+# the test skeleton.
+$(tests:%=$(objpfx)%.o): CPPFLAGS += -DTEST_NO_MALLOPT
diff --git a/test-skeleton.c b/test-skeleton.c
index d9bf989fa8..5a90c65826 100644
--- a/test-skeleton.c
+++ b/test-skeleton.c
@@ -346,8 +346,10 @@ main (int argc, char *argv[])
   unsigned int timeoutfactor = 1;
   pid_t termpid;
 
+#ifndef TEST_NO_MALLOPT
   /* Make uses of freed and uninitialized memory known.  */
   mallopt (M_PERTURB, 42);
+#endif
 
 #ifdef STDOUT_UNBUFFERED
   setbuf (stdout, NULL);