]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Fix an error in the qp_test.c unit test
authorAram Sargsyan <aram@isc.org>
Thu, 19 Oct 2023 08:46:58 +0000 (08:46 +0000)
committerAram Sargsyan <aram@isc.org>
Thu, 19 Oct 2023 08:46:58 +0000 (08:46 +0000)
In order to check whether there are enough inserted values the
code uses the 'tests' variable (loop counter), which is unreliable,
because the loop sometimes removes an item instead of inserting
one (when the randomly generated item already exists).

Instead of the loop counter, use the existing variable 'inserted',
which should indicate the correct number of the inserted items.

tests/dns/qp_test.c

index f15022618f9f14c8c20081dd957f3038ccf67d9c..39c9b688b51e3b559629af87d7bfe1488f584cdd 100644 (file)
@@ -271,7 +271,7 @@ ISC_RUN_TEST_IMPL(qpiter) {
                 * forward a few steps, then back to the start,
                 * to confirm we can change directions while iterating.
                 */
-               if (tests > 3) {
+               if (inserted > 3) {
                        assert_int_equal(
                                dns_qpiter_next(&qpi, NULL, NULL, &ival),
                                ISC_R_SUCCESS);