mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
Merge branch '471-fix-rbt_insert_and_remove-unit-test' into 'master'
Prevent rare rbt_insert_and_remove unit test failures Closes #471 See merge request isc-projects/bind9!614
This commit is contained in:
commit
527614c750
1 changed files with 13 additions and 0 deletions
|
|
@ -910,6 +910,7 @@ insert_nodes(dns_rbt_t *mytree, char **names,
|
|||
node->data = n;
|
||||
names[*names_count] = isc_mem_strdup(mctx,
|
||||
namebuf);
|
||||
ATF_REQUIRE(names[*names_count] != NULL);
|
||||
*names_count += 1;
|
||||
break;
|
||||
}
|
||||
|
|
@ -995,6 +996,7 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) {
|
|||
*/
|
||||
isc_result_t result;
|
||||
dns_rbt_t *mytree = NULL;
|
||||
size_t *n;
|
||||
/*
|
||||
* We use an array for storing names instead of a set
|
||||
* structure. It's slow, but works and is good enough for tests.
|
||||
|
|
@ -1013,6 +1015,11 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) {
|
|||
result = dns_rbt_create(mctx, delete_data, NULL, &mytree);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
n = isc_mem_get(mctx, sizeof(size_t));
|
||||
ATF_REQUIRE(n != NULL);
|
||||
result = dns_rbt_addname(mytree, dns_rootname, n);
|
||||
ATF_REQUIRE_EQ(result, ISC_R_SUCCESS);
|
||||
|
||||
memset(names, 0, sizeof(names));
|
||||
names_count = 0;
|
||||
|
||||
|
|
@ -1051,6 +1058,12 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) {
|
|||
}
|
||||
}
|
||||
|
||||
result = dns_rbt_deletename(mytree, dns_rootname, false);
|
||||
ATF_CHECK_EQ_MSG(result, ISC_R_SUCCESS,
|
||||
"result: %s", isc_result_totext(result));
|
||||
ATF_CHECK_EQ_MSG(dns_rbt_nodecount(mytree), 0,
|
||||
"%u != 0", dns_rbt_nodecount(mytree));
|
||||
|
||||
dns_rbt_destroy(&mytree);
|
||||
|
||||
dns_test_end();
|
||||
|
|
|
|||
Loading…
Reference in a new issue