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>
Tue, 14 Jul 2009 09:58:16 +0000 (11:58 +0200)
metze

lib/talloc/testsuite.c

index ebcdac05f8ff1ba9e84d0ec8da0a4903124ceb6d..6057fc11c5fea4317495957d0596c9f2a37d5cbe 100644 (file)
@@ -111,6 +111,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 
@@ -1280,6 +1299,7 @@ static bool test_pool(void)
 
 static void test_reset(void)
 {
+       test_abort_stop();
        talloc_disable_null_tracking();
        talloc_enable_null_tracking();
 }