summaryrefslogtreecommitdiff
path: root/malloc/tst-malloc-backtrace.c
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-12-09 08:18:27 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-12-09 08:18:27 +0100
commitc23de0aacbeaa7a091609b35764bed931475a16d (patch)
treebe4396f71292ee7a509912d70e74323d1587d227 /malloc/tst-malloc-backtrace.c
parentc03073774f915fe7841c2b551fe304544143470f (diff)
support: Introduce new subdirectory for test infrastructure
The new test driver in <support/test-driver.c> has feature parity with the old one. The main difference is that its hooking mechanism is based on functions and function pointers instead of macros. This commit also implements a new environment variable, TEST_COREDUMPS, which disables the code which disables coredumps (that is, it enables them if the invocation environment has not disabled them). <test-skeleton.c> defines wrapper functions so that it is possible to use existing macros with the new-style hook functionality. This commit changes only a few test cases to the new test driver, to make sure that it works as expected.
Diffstat (limited to 'malloc/tst-malloc-backtrace.c')
-rw-r--r--malloc/tst-malloc-backtrace.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/malloc/tst-malloc-backtrace.c b/malloc/tst-malloc-backtrace.c
index 3aee7fdb28..1f1f0e803c 100644
--- a/malloc/tst-malloc-backtrace.c
+++ b/malloc/tst-malloc-backtrace.c
@@ -16,9 +16,11 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-
+#include <signal.h>
#include <stdlib.h>
+#include <support/support.h>
+
#define SIZE 4096
/* Wrap free with a function to prevent gcc from optimizing it out. */
@@ -30,13 +32,6 @@ call_free (void *ptr)
*(size_t *)(ptr - sizeof (size_t)) = 1;
}
-int do_test (void);
-
-#define TEST_FUNCTION do_test ()
-#define EXPECTED_SIGNAL SIGABRT
-
-#include "../test-skeleton.c"
-
int
do_test (void)
{
@@ -53,3 +48,6 @@ do_test (void)
doesn't optimize out that malloc call. */
return (ptr1 == ptr2);
}
+
+#define EXPECTED_SIGNAL SIGABRT
+#include <support/test-driver.c>