public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] malloc: Run tests without calling mallopt [BZ #19469]
@ 2016-06-24 17:34 Florian Weimer
  2016-06-28 13:36 ` [PATCH v2] " Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2016-06-24 17:34 UTC (permalink / raw)
  To: libc-alpha

The compiled tests no longer refer to the mallopt symbol
from their main functions.  (Some tests still call mallopt
explicitly, which is fine.)

2016-06-24  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.

diff --git a/malloc/Makefile b/malloc/Makefile
index fa1730e..0ca15d6 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.
+CPPFLAGS += $(if $(filter $(*F),$(tests) $(test-srcs)),-DTEST_NO_MALLOPT)
diff --git a/test-skeleton.c b/test-skeleton.c
index d9bf989..5a90c65 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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH v2] malloc: Run tests without calling mallopt [BZ #19469]
  2016-06-24 17:34 [PATCH] malloc: Run tests without calling mallopt [BZ #19469] Florian Weimer
@ 2016-06-28 13:36 ` Florian Weimer
  2016-08-02 15:08   ` Florian Weimer
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Weimer @ 2016-06-28 13:36 UTC (permalink / raw)
  To: libc-alpha

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

On 06/24/2016 07:34 PM, Florian Weimer wrote:
> The compiled tests no longer refer to the mallopt symbol
> from their main functions.  (Some tests still call mallopt
> explicitly, which is fine.)

New version, avoiding quadratic behavior and delayed expansion.

Also see: <https://sourceware.org/ml/libc-alpha/2016-06/msg01120.html>

Thanks,
Florian


[-- Attachment #2: mallopt.patch --]
[-- Type: text/x-patch, Size: 1226 bytes --]

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.)

2016-06-28  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.

diff --git a/malloc/Makefile b/malloc/Makefile
index fa1730e..4d5c81d 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 d9bf989..5a90c65 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);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] malloc: Run tests without calling mallopt [BZ #19469]
  2016-06-28 13:36 ` [PATCH v2] " Florian Weimer
@ 2016-08-02 15:08   ` Florian Weimer
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Weimer @ 2016-08-02 15:08 UTC (permalink / raw)
  To: libc-alpha

On 06/28/2016 03:35 PM, Florian Weimer wrote:
> On 06/24/2016 07:34 PM, Florian Weimer wrote:
>> The compiled tests no longer refer to the mallopt symbol
>> from their main functions.  (Some tests still call mallopt
>> explicitly, which is fine.)
>
> New version, avoiding quadratic behavior and delayed expansion.
>
> Also see: <https://sourceware.org/ml/libc-alpha/2016-06/msg01120.html>

I have committed this.

Thanks,
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-02 15:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 17:34 [PATCH] malloc: Run tests without calling mallopt [BZ #19469] Florian Weimer
2016-06-28 13:36 ` [PATCH v2] " Florian Weimer
2016-08-02 15:08   ` Florian Weimer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).