@@ -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)
@@ -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);