summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>2020-10-20 14:10:30 -0500
committerAndrew Bartlett <abartlet@samba.org>2020-11-09 02:46:49 +0000
commit30a8bea8a340dcf9a3120f5ee8041e62fb129d8d (patch)
treec6d5d97b31f95ef7bfb312e8a71aa8360b8065c7 /lib/talloc
parent6e0aab0b4038255b2d63e8687924a21d77bace91 (diff)
downloadsamba-30a8bea8a340dcf9a3120f5ee8041e62fb129d8d.tar.gz
lib: talloc: Add more debugging text for existing memlimit + pool tests
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14540 Signed-off-by: Arran Cudbard-Bell <a.cudbardb@freeradius.org> Reviewed-by: Jeremy Allison <jra@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/testsuite.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/talloc/testsuite.c b/lib/talloc/testsuite.c
index 6c9bf203b7c..571c32ca00f 100644
--- a/lib/talloc/testsuite.c
+++ b/lib/talloc/testsuite.c
@@ -1767,24 +1767,38 @@ static bool test_memlimit(void)
talloc_free(root);
/* Test memlimits with pools. */
+ printf("==== talloc_pool(NULL, 10*1024)\n");
pool = talloc_pool(NULL, 10*1024);
torture_assert("memlimit", pool != NULL,
"failed: alloc should not fail due to memory limit\n");
+
+ printf("==== talloc_set_memlimit(pool, 10*1024)\n");
talloc_set_memlimit(pool, 10*1024);
for (i = 0; i < 9; i++) {
+ printf("==== talloc_size(pool, 1024) %i/10\n", i + 1);
l1 = talloc_size(pool, 1024);
torture_assert("memlimit", l1 != NULL,
"failed: alloc should not fail due to memory limit\n");
+ talloc_report_full(pool, stdout);
}
/* The next alloc should fail. */
+ printf("==== talloc_size(pool, 1024) 10/10\n");
l2 = talloc_size(pool, 1024);
torture_assert("memlimit", l2 == NULL,
"failed: alloc should fail due to memory limit\n");
+ talloc_report_full(pool, stdout);
+
/* Moving one of the children shouldn't change the limit,
as it's still inside the pool. */
+
+ printf("==== talloc_new(NULL)\n");
root = talloc_new(NULL);
+
+ printf("==== talloc_steal(root, l1)\n");
talloc_steal(root, l1);
+
+ printf("==== talloc_size(pool, 1024)\n");
l2 = talloc_size(pool, 1024);
torture_assert("memlimit", l2 == NULL,
"failed: alloc should fail due to memory limit\n");