talloc/testsuite: add infrastructure to test aborts
authorStefan Metzmacher <metze@samba.org>
Tue, 14 Jul 2009 09:58:16 +0000 (11:58 +0200)
committerAndrew Tridgell <tridge@samba.org>
Mon, 24 Aug 2009 06:29:57 +0000 (16:29 +1000)
metze

lib/talloc/testsuite.c

index 262228760ac9cf235633bb258770eb0540683109..2ee33287bd6e2bcf54be46cab603601b174ec6fd 100644 (file)
@@ -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();
 }