X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=test%2FCMakeLists.txt;h=6f8230fb8aea95c297ff8aeada756361decb2b81;hb=a7e11259b99326ef0d32a1029166aa53546c2708;hp=ebb39afe84a755f11b8da79f8ca69ac91b1f7f2d;hpb=36c2351bfeb343f4d6da922cdee58f4bcdcd7e08;p=m6w6%2Flibmemcached diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ebb39afe..6f8230fb 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -2,14 +2,26 @@ if(NOT BUILD_TESTING OR NOT CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) return() endif() -include(CMake/Catch.cmake) +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake") +include(Catch) +include(CheckTbb) + +if(NOT MEMCACHED_BINARY) + message(SEND_ERROR "Could not find memcached(1) binary") + set(ENV{INVALID_CONFIGURATION} 1) +endif() check_decl(pipe2 unistd.h) check_decl(SOCK_NONBLOCK sys/socket.h) check_decl(SOCK_CLOEXEC sys/socket.h) +check_decl(waitid sys/wait.h) +if(HAVE_WAITID) + check_compiles(HAVE_WAITID_NOWAIT "siginfo_t s; waitid(P_ALL, 0, &s, WNOWAIT|WEXITED);" sys/types.h sys/wait.h) +endif() file(GLOB_RECURSE TESTING_SRC RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp) set(TESTING_ROOT ${CMAKE_CURRENT_BINARY_DIR}) +set(SOURCES_ROOT ${CMAKE_SOURCE_DIR}) set_source_files_properties(main.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION ON) configure_file(conf.h.in conf.h @ONLY) add_executable(runtests ${TESTING_SRC}) @@ -20,7 +32,18 @@ target_include_directories(runtests PRIVATE ${CMAKE_SOURCE_DIR}/src ${CMAKE_BINARY_DIR}/src) target_link_libraries(runtests PRIVATE libhashkit libmemcachedinternal libmemcachedutil) + +if(NOT (thread IN_LIST ENABLE_SANITIZERS)) + check_tbb() + if(HAVE_TBB) + target_link_libraries(runtests PRIVATE ${LIBTBB}) + endif() +endif() + add_dependencies(runtests ${CLIENTS}) +if(HAVE_MEMASLAP) + add_dependencies(runtests memaslap) +endif() catch_discover_tests(runtests TEST_SPEC "lib*")