static unsigned int test_abort_count;
-#if 0
static void test_abort_fn(const char *reason)
{
printf("# test_abort_fn(%s)\n", reason);
test_abort_count = 0;
talloc_set_abort_fn(test_abort_fn);
}
-#endif
static void test_abort_stop(void)
{
CHECK_BLOCKS("misc", p1, 1);
CHECK_BLOCKS("misc", root, 2);
p2 = talloc_strdup(p1, "foo");
+
+ /* this is expected to abort */
+ test_abort_start();
torture_assert("misc", talloc_unlink(root, p2) == -1,
"failed: talloc_unlink() of non-reference context should return -1\n");
+ torture_assert("misc", test_abort_count == 1,
+ "failed: talloc_unlink() of non-reference context should abort\n");
+ test_abort_stop();
torture_assert("misc", talloc_unlink(p1, p2) == 0,
"failed: talloc_unlink() of parent should succeed\n");
+
talloc_unlink(NULL, p1);
CHECK_BLOCKS("misc", p1, 1);
CHECK_BLOCKS("misc", root, 2);