bind9-next/bind-9.19-tests-dns-rbtdb-i...

51 lines
1.8 KiB
Diff

From 2514f8d77d52da0e95af4256f9ae9905b890e69e Mon Sep 17 00:00:00 2001
From: Petr Mensik <pemensik@redhat.com>
Date: Wed, 6 Sep 2023 20:20:53 +0200
Subject: [PATCH] Use range to show value for rbtdb overmempurge_ tests
overmempurge_longname is failing reliably on i686 builds. If that
happens, make displaying failing values part of the output.
FIXME: Includes debug tests
---
tests/dns/rbtdb_test.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/tests/dns/rbtdb_test.c b/tests/dns/rbtdb_test.c
index 6f2ab3c..f1046b9 100644
--- a/tests/dns/rbtdb_test.c
+++ b/tests/dns/rbtdb_test.c
@@ -328,7 +328,7 @@ ISC_RUN_TEST_IMPL(overmempurge_bigrdata) {
*/
while (i-- > 0) {
overmempurge_addrdataset(db, now, i, 50054, 65535, false);
- assert_true(isc_mem_inuse(mctx2) < maxcache);
+ assert_in_range(isc_mem_inuse(mctx2), 0, maxcache-1);
}
dns_db_detach(&db);
@@ -360,6 +360,8 @@ ISC_RUN_TEST_IMPL(overmempurge_longname) {
* iteration to avoid an infinite loop in case something gets wrong.
*/
for (i = 0; !isc_mem_isovermem(mctx2) && i < (maxcache / 10); i++) {
+ printf("Mem in use #%zu: %zu\n", i, isc_mem_inuse(mctx2));
+ assert_in_range(isc_mem_inuse(mctx2), 0, maxcache-1);
overmempurge_addrdataset(db, now, i, 50053, 0, false);
}
assert_true(isc_mem_isovermem(mctx2));
@@ -371,8 +373,10 @@ ISC_RUN_TEST_IMPL(overmempurge_longname) {
* size doesn't reach the "max".
*/
while (i-- > 0) {
+ printf("Mem in use before #%zu: %zu\n", i, isc_mem_inuse(mctx2));
overmempurge_addrdataset(db, now, i, 50054, 0, true);
- assert_true(isc_mem_inuse(mctx2) < maxcache);
+ printf("Mem in use after #%zu: %zu\n", i, isc_mem_inuse(mctx2));
+ assert_in_range(isc_mem_inuse(mctx2), 0, maxcache-1);
}
dns_db_detach(&db);
--
2.41.0