From: Mark Andrews Date: Mon, 13 Nov 2017 04:26:35 +0000 (+1100) Subject: 4815. [bug] rbt_test.c:insert_and_delete needed to call X-Git-Tag: v9.11.3b1~185 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=70e041bea19b6ad9522b89c2299ad315a2deaafd;p=thirdparty%2Fbind9.git 4815. [bug] rbt_test.c:insert_and_delete needed to call dns_rbt_addnode instead of dns_rbt_addname. [RT #46553] (cherry picked from commit 04934b28ea851c22ee78842212770db5abacb0fb) --- diff --git a/CHANGES b/CHANGES index 1094a587d47..cd0e5514e55 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,6 @@ +4815. [bug] rbt_test.c:insert_and_delete needed to call + dns_rbt_addnode instead of dns_rbt_addname. [RT #46553] + 4814. [cleanup] Use AS_HELP_STRING for consistent help text. [RT #46521] 4812. [bug] Minor improvements to stability and consistency of code diff --git a/lib/dns/tests/rbt_test.c b/lib/dns/tests/rbt_test.c index 616f23dbe33..e719c86b837 100644 --- a/lib/dns/tests/rbt_test.c +++ b/lib/dns/tests/rbt_test.c @@ -894,6 +894,7 @@ insert_nodes(dns_rbt_t *mytree, char **names, size_t *names_count, isc_uint32_t num_names) { isc_uint32_t i; + dns_rbtnode_t *node; for (i = 0; i < num_names; i++) { size_t *n; @@ -921,8 +922,10 @@ insert_nodes(dns_rbt_t *mytree, char **names, build_name_from_str(namebuf, &fname); name = dns_fixedname_name(&fname); - result = dns_rbt_addname(mytree, name, n); + node = NULL; + result = dns_rbt_addnode(mytree, name, &node); if (result == ISC_R_SUCCESS) { + node->data = n; names[*names_count] = isc_mem_strdup(mctx, namebuf); *names_count += 1; @@ -966,12 +969,17 @@ remove_nodes(dns_rbt_t *mytree, char **names, } static void -check_tree(dns_rbt_t *mytree, char **names, size_t names_count) { +check_tree(dns_rbt_t *mytree, char **names, size_t names_count, + unsigned int line) +{ isc_boolean_t tree_ok; UNUSED(names); - ATF_CHECK_EQ(names_count + 1, dns_rbt_nodecount(mytree)); + ATF_CHECK_EQ_MSG(names_count + 1, dns_rbt_nodecount(mytree), + "line:%u: %lu != %u", line, + (unsigned long)(names_count + 1), + dns_rbt_nodecount(mytree)); /* * The distance from each node to its sub-tree root must be less @@ -1041,7 +1049,7 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) { } insert_nodes(mytree, names, &names_count, num_names); - check_tree(mytree, names, names_count); + check_tree(mytree, names, names_count, __LINE__); isc_random_get(&num_names); if (names_count > 0) { @@ -1052,12 +1060,12 @@ ATF_TC_BODY(rbt_insert_and_remove, tc) { } remove_nodes(mytree, names, &names_count, num_names); - check_tree(mytree, names, names_count); + check_tree(mytree, names, names_count, __LINE__); } /* Remove the rest of the nodes */ remove_nodes(mytree, names, &names_count, names_count); - check_tree(mytree, names, names_count); + check_tree(mytree, names, names_count, __LINE__); for (i = 0; i < 1024; i++) { if (names[i] != NULL) {