diff --git a/bin/tests/db_test.c b/bin/tests/db_test.c index b367eeba84..0f7c64d0cf 100644 --- a/bin/tests/db_test.c +++ b/bin/tests/db_test.c @@ -613,10 +613,11 @@ main(int argc, char *argv[]) { } else if (strstr(s, "!V") == s) { DBI_CHECK(dbi); v = atoi(&s[2]); - if (v >= dbi->rcount) { + if (v >= dbi->rcount || v < 0) { printf("unknown open version %d\n", v); continue; - } else if (dbi->rversions[v] == NULL) { + } + if (dbi->rversions[v] == NULL) { printf("version %d is not open\n", v); continue; } diff --git a/bin/tests/shutdown_test.c b/bin/tests/shutdown_test.c index 7ccce80851..0dcf3b82c9 100644 --- a/bin/tests/shutdown_test.c +++ b/bin/tests/shutdown_test.c @@ -174,9 +174,13 @@ main(int argc, char *argv[]) { RUNTIME_CHECK(isc_app_start() == ISC_R_SUCCESS); - if (argc > 1) + if (argc > 1) { workers = atoi(argv[1]); - else + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else workers = 2; printf("%d workers\n", workers); diff --git a/bin/tests/sock_test.c b/bin/tests/sock_test.c index 8f33a7ed49..f6d2a39222 100644 --- a/bin/tests/sock_test.c +++ b/bin/tests/sock_test.c @@ -263,9 +263,13 @@ main(int argc, char *argv[]) { isc_result_t result; int pf; - if (argc > 1) + if (argc > 1) { workers = atoi(argv[1]); - else + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else workers = 2; printf("%d workers\n", workers); diff --git a/bin/tests/task_test.c b/bin/tests/task_test.c index e3ff26b56c..2e162b6d1e 100644 --- a/bin/tests/task_test.c +++ b/bin/tests/task_test.c @@ -69,9 +69,13 @@ main(int argc, char *argv[]) { isc_timer_t *ti1, *ti2; struct isc_interval interval; - if (argc > 1) + if (argc > 1) { workers = atoi(argv[1]); - else + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else workers = 2; printf("%d workers\n", workers); diff --git a/bin/tests/timer_test.c b/bin/tests/timer_test.c index 2825dc58e9..cb5459ccf2 100644 --- a/bin/tests/timer_test.c +++ b/bin/tests/timer_test.c @@ -102,9 +102,13 @@ main(int argc, char *argv[]) { isc_time_t expires, now; isc_interval_t interval; - if (argc > 1) + if (argc > 1) { workers = atoi(argv[1]); - else + if (workers < 1) + workers = 1; + if (workers > 8192) + workers = 8192; + } else workers = 2; printf("%d workers\n", workers);