]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Use read number of items instead of raw array size in load_names
authorOndřej Surý <ondrej@isc.org>
Fri, 6 Oct 2023 08:06:36 +0000 (10:06 +0200)
committerOndřej Surý <ondrej@isc.org>
Mon, 9 Oct 2023 19:04:21 +0000 (21:04 +0200)
The load_names benchmark expected the input CSV with domains would fill
the whole item array and it would crash when the number of lines would
be less than that.

Fix the expectations by using the real number or lines read to calculate
the array start and end position for each benchmark thread.

tests/bench/load-names.c

index 7d5c8b004e26773a0ce7d87eac39fca5abb68ebb..752d7e8b58b7f9b9a4147b02df5d79011ca6e31e 100644 (file)
@@ -552,7 +552,7 @@ main(int argc, char *argv[]) {
                        isc_mem_create(&mem);
                        map = fun->new (mem);
 
-                       size_t nitems = ARRAY_SIZE(item) / (nthreads + 1);
+                       size_t nitems = lines / (nthreads + 1);
 
                        isc_barrier_init(&barrier, nthreads);