e48f32
From 38445f372fa494f541e566568a022c58c2e0a1e3 Mon Sep 17 00:00:00 2001
e48f32
From: Petr Mensik <pemensik@redhat.com>
e48f32
Date: Mon, 30 Nov 2020 21:53:43 +0100
e48f32
Subject: [PATCH] Pass task_test also with threads disabled
e48f32
e48f32
Condition cv is declared only when threads are used. Use it only in that
e48f32
case. Test compiles and passes without thread support also.
e48f32
---
e48f32
 lib/isc/tests/task_test.c | 8 ++++++++
e48f32
 1 file changed, 8 insertions(+)
e48f32
e48f32
diff --git a/lib/isc/tests/task_test.c b/lib/isc/tests/task_test.c
e48f32
index 151a9ea..c1c2005 100644
e48f32
--- a/lib/isc/tests/task_test.c
e48f32
+++ b/lib/isc/tests/task_test.c
e48f32
@@ -61,8 +61,10 @@ _setup(void **state) {
e48f32
 	result = isc_mutex_init(&lock);
e48f32
 	assert_int_equal(result, ISC_R_SUCCESS);
e48f32
 
e48f32
+#ifdef ISC_PLATFORM_USETHREADS
e48f32
 	result = isc_condition_init(&cv;;
e48f32
 	assert_int_equal(result, ISC_R_SUCCESS);
e48f32
+#endif
e48f32
 
e48f32
 	result = isc_test_begin(NULL, true, 0);
e48f32
 	assert_int_equal(result, ISC_R_SUCCESS);
e48f32
@@ -79,8 +81,10 @@ _setup2(void **state) {
e48f32
 	result = isc_mutex_init(&lock);
e48f32
 	assert_int_equal(result, ISC_R_SUCCESS);
e48f32
 
e48f32
+#ifdef ISC_PLATFORM_USETHREADS
e48f32
 	result = isc_condition_init(&cv;;
e48f32
 	assert_int_equal(result, ISC_R_SUCCESS);
e48f32
+#endif
e48f32
 
e48f32
 	/* Two worker threads */
e48f32
 	result = isc_test_begin(NULL, true, 2);
e48f32
@@ -98,8 +102,10 @@ _setup4(void **state) {
e48f32
 	result = isc_mutex_init(&lock);
e48f32
 	assert_int_equal(result, ISC_R_SUCCESS);
e48f32
 
e48f32
+#ifdef ISC_PLATFORM_USETHREADS
e48f32
 	result = isc_condition_init(&cv;;
e48f32
 	assert_int_equal(result, ISC_R_SUCCESS);
e48f32
+#endif
e48f32
 
e48f32
 	/* Four worker threads */
e48f32
 	result = isc_test_begin(NULL, true, 4);
e48f32
@@ -113,7 +119,9 @@ _teardown(void **state) {
e48f32
 	UNUSED(state);
e48f32
 
e48f32
 	isc_test_end();
e48f32
+#ifdef ISC_PLATFORM_USETHREADS
e48f32
 	isc_condition_destroy(&cv;;
e48f32
+#endif
e48f32
 
e48f32
 	return (0);
e48f32
 }
e48f32
-- 
e48f32
2.26.2
e48f32