#define torture_assert(test, expr, str) if (!(expr)) { \
printf("failure: %s [\n%s: Expression %s failed: %s\n]\n", \
test, __location__, #expr, str); \
+ abort(); \
return false; \
}
} else if (strcmp(arg1, arg2)) { \
printf("failure: %s [\n%s: Expected %s, got %s: %s\n]\n", \
test, __location__, arg1, arg2, desc); \
+ abort(); \
return false; \
}
(unsigned)talloc_total_size(ptr), \
(unsigned)tsize); \
talloc_report_full(ptr, stdout); \
+ abort(); \
return false; \
} \
} while (0)
(unsigned)talloc_total_blocks(ptr), \
(unsigned)tblocks); \
talloc_report_full(ptr, stdout); \
+ abort(); \
return false; \
} \
} while (0)
talloc_report_full(ptr, stdout); \
talloc_report_full(parent, stdout); \
talloc_report_full(NULL, stdout); \
+ abort(); \
return false; \
} \
} while (0)
talloc_unlink(r1, p2);
talloc_report_full(root, stderr);
- CHECK_BLOCKS("ref1", p1, 5);
+ CHECK_BLOCKS("ref1", p1, 4);
CHECK_BLOCKS("ref1", p2, 1);
- CHECK_BLOCKS("ref1", r1, 1);
+ CHECK_BLOCKS("ref1", r1, 2);
fprintf(stderr, "Freeing p1\n");
talloc_free(p1);
talloc_report_full(root, stderr);
- CHECK_BLOCKS("ref1", r1, 1);
+ CHECK_BLOCKS("ref1", r1, 2);
fprintf(stderr, "Freeing r1\n");
talloc_free(r1);
talloc_unlink(r1, ref);
talloc_report_full(root, stderr);
- CHECK_BLOCKS("ref2", p1, 5);
+ CHECK_BLOCKS("ref2", p1, 4);
CHECK_BLOCKS("ref2", p2, 1);
- CHECK_BLOCKS("ref2", r1, 1);
+ CHECK_BLOCKS("ref2", r1, 2);
fprintf(stderr, "Freeing p2\n");
talloc_free(p2);
torture_assert("misc", !p1, "failed: large talloc allowed\n");
p1 = talloc_strdup(root, "foo");
+ CHECK_BLOCKS("misc", p1, 1);
+ CHECK_BLOCKS("misc", root, 2);
+ CHECK_BLOCKS("misc", talloc_parent(root), 3);
talloc_increase_ref_count(p1);
talloc_increase_ref_count(p1);
talloc_increase_ref_count(p1);
CHECK_BLOCKS("misc", p1, 1);
CHECK_BLOCKS("misc", root, 2);
+ CHECK_BLOCKS("misc", NULL, 6);
talloc_unlink(NULL, p1);
CHECK_BLOCKS("misc", p1, 1);
- CHECK_BLOCKS("misc", root, 2);
+ CHECK_BLOCKS("misc", root, 1);
+ CHECK_BLOCKS("misc", NULL, 5);
talloc_unlink(NULL, p1);
CHECK_BLOCKS("misc", p1, 1);
CHECK_BLOCKS("misc", root, 2);
+ CHECK_BLOCKS("misc", NULL, 4);
p2 = talloc_strdup(p1, "foo");
torture_assert("misc", talloc_unlink(root, p2) == -1,
"failed: talloc_unlink() of non-reference context should return -1\n");