From f8559b8238409b28ba198c89e6a31e62cf28df88 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 14 Jul 2009 11:58:16 +0200 Subject: talloc/testsuite: add infrastructure to test aborts metze --- lib/talloc/testsuite.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c index 262228760a..2ee33287bd 100644 --- a/lib/talloc/testsuite.c +++ b/lib/talloc/testsuite.c @@ -99,6 +99,25 @@ static double timeval_elapsed(struct timeval *tv) } \ } while (0) +static unsigned int test_abort_count; + +static void test_abort_fn(const char *reason) +{ + printf("# test_abort_fn(%s)\n", reason); + test_abort_count++; +} + +static void test_abort_start(void) +{ + test_abort_count = 0; + talloc_set_abort_fn(test_abort_fn); +} + +static void test_abort_stop(void) +{ + test_abort_count = 0; + talloc_set_abort_fn(NULL); +} /* test references @@ -1109,6 +1128,7 @@ static bool test_pool(void) static void test_reset(void) { + test_abort_stop(); talloc_disable_null_tracking(); talloc_enable_null_tracking(); } -- cgit