From: Petr Mensik Date: Mon, 30 Nov 2020 20:53:43 +0000 (+0100) Subject: Pass task_test also with threads disabled X-Git-Tag: v9.11.26~3^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=839350f5f6334a457c6ada94c27489faf5eb869b;p=thirdparty%2Fbind9.git Pass task_test also with threads disabled Condition cv is declared only when threads are used. Use it only in that case. Test compiles and passes without thread support also. --- diff --git a/lib/isc/tests/task_test.c b/lib/isc/tests/task_test.c index 151a9ea7b23..c1c20058c2f 100644 --- a/lib/isc/tests/task_test.c +++ b/lib/isc/tests/task_test.c @@ -61,8 +61,10 @@ _setup(void **state) { result = isc_mutex_init(&lock); assert_int_equal(result, ISC_R_SUCCESS); +#ifdef ISC_PLATFORM_USETHREADS result = isc_condition_init(&cv); assert_int_equal(result, ISC_R_SUCCESS); +#endif result = isc_test_begin(NULL, true, 0); assert_int_equal(result, ISC_R_SUCCESS); @@ -79,8 +81,10 @@ _setup2(void **state) { result = isc_mutex_init(&lock); assert_int_equal(result, ISC_R_SUCCESS); +#ifdef ISC_PLATFORM_USETHREADS result = isc_condition_init(&cv); assert_int_equal(result, ISC_R_SUCCESS); +#endif /* Two worker threads */ result = isc_test_begin(NULL, true, 2); @@ -98,8 +102,10 @@ _setup4(void **state) { result = isc_mutex_init(&lock); assert_int_equal(result, ISC_R_SUCCESS); +#ifdef ISC_PLATFORM_USETHREADS result = isc_condition_init(&cv); assert_int_equal(result, ISC_R_SUCCESS); +#endif /* Four worker threads */ result = isc_test_begin(NULL, true, 4); @@ -113,7 +119,9 @@ _teardown(void **state) { UNUSED(state); isc_test_end(); +#ifdef ISC_PLATFORM_USETHREADS isc_condition_destroy(&cv); +#endif return (0); }