talloc/testsuite: add infrastructure to test aborts
authorStefan Metzmacher <metze@samba.org>
Tue, 14 Jul 2009 09:58:16 +0000 (11:58 +0200)
committerStefan Metzmacher <metze@samba.org>
Fri, 24 Jul 2009 08:45:48 +0000 (10:45 +0200)
metze

lib/talloc/testsuite.c

index 4c931a1b8461bdf8eb0875df1cd746304415e26a..6a55a3abbedbf7f659c3c1a2344fce3627d50873 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 
@@ -1105,6 +1124,7 @@ static bool test_pool(void)
 
 static void test_reset(void)
 {
+       test_abort_stop();
        talloc_disable_null_tracking();
        talloc_enable_null_tracking();
 }