]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Pass task_test also with threads disabled
authorPetr Mensik <pemensik@redhat.com>
Mon, 30 Nov 2020 20:53:43 +0000 (21:53 +0100)
committerMark Andrews <marka@isc.org>
Tue, 1 Dec 2020 23:06:19 +0000 (23:06 +0000)
Condition cv is declared only when threads are used. Use it only in that
case. Test compiles and passes without thread support also.

lib/isc/tests/task_test.c

index 151a9ea7b2345890609a28a297f184f2431d9f8f..c1c20058c2f84eca6ebeb020118f6d6682af679d 100644 (file)
@@ -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);
 }