summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorBjörn Svensson <bjorn.a.svensson@est.tech>2021-10-25 10:13:48 +0200
committerBjörn Svensson <bjorn.a.svensson@est.tech>2021-10-26 09:54:44 +0200
commit648763c36e9f6493b13a77da35eb33ef0652b4e2 (patch)
tree0428b4fdc5b89f1d737b4e267dc279f36c1a9c06 /CMakeLists.txt
parentc98c6994ded45e774c3459baa2936f06f8a2c331 (diff)
Add build options for enabling async tests
Asynchronous testcases that requires the event library `libevent` can be built and enabled by using the added build flags: - ENABLE_ASYNC_TESTS when using CMake - TEST_ASYNC when using Make The async tests are disabled by default to avoid adding new requirements, but the testcases are built and run in CI.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt10
1 files changed, 7 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index eb43f01..6d290a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@ PROJECT(hiredis)
OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF)
OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF)
OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF)
+OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF)
MACRO(getVersionBit name)
SET(VERSION_REGEX "^#define ${name} (.+)$")
@@ -218,11 +219,14 @@ ENDIF()
IF(NOT DISABLE_TESTS)
ENABLE_TESTING()
ADD_EXECUTABLE(hiredis-test test.c)
+ TARGET_LINK_LIBRARIES(hiredis-test hiredis)
IF(ENABLE_SSL_TESTS)
ADD_DEFINITIONS(-DHIREDIS_TEST_SSL=1)
- TARGET_LINK_LIBRARIES(hiredis-test hiredis hiredis_ssl)
- ELSE()
- TARGET_LINK_LIBRARIES(hiredis-test hiredis)
+ TARGET_LINK_LIBRARIES(hiredis-test hiredis_ssl)
+ ENDIF()
+ IF(ENABLE_ASYNC_TESTS)
+ ADD_DEFINITIONS(-DHIREDIS_TEST_ASYNC=1)
+ TARGET_LINK_LIBRARIES(hiredis-test event)
ENDIF()
ADD_TEST(NAME hiredis-test
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/test.sh)