Skip to content

Commit

Permalink
Cleanup libcheck related code
Browse files Browse the repository at this point in the history
- Ref twitter#202, twitter/pelikan@14fcd34
- Replace CHECK_WORKING with CHECK_FOUND
  • Loading branch information
michalbiesek committed Sep 9, 2019
1 parent 683bc1a commit 97d9cd3
Show file tree
Hide file tree
Showing 16 changed files with 5 additions and 30 deletions.
19 changes: 5 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,6 @@ include(FindPackageHandleStandardArgs)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")

find_package(Check)
if(NOT CHECK_FOUND)
message(WARNING "Check is required to build and run tests")
endif(NOT CHECK_FOUND)
if(CHECK_FOUND)
check_symbol_exists(ck_assert_int_eq check.h CHECK_WORKING)
if(NOT CHECK_WORKING)
message(WARNING "Check version too old to build tests")
endif(NOT CHECK_WORKING)
endif(CHECK_FOUND)

if (HAVE_ITT_INSTRUMENTATION)
if(PKG_CONFIG_FOUND)
pkg_check_modules(ITTNOTIFY REQUIRED ittnotify>=1.0)
Expand All @@ -192,10 +182,11 @@ include_directories(

add_subdirectory(src)

if(CHECK_WORKING)
include_directories(${include_directories} "${CHECK_INCLUDES}")
if(CHECK_FOUND)
include_directories(${CHECK_INCLUDE_DIRS})
link_directories(${CHECK_LIBRARY_DIRS})
add_subdirectory(test)
endif(CHECK_WORKING)
endif(CHECK_FOUND)


if(HAVE_RUST)
Expand All @@ -221,4 +212,4 @@ message(STATUS "HAVE_SIGNAME: " ${HAVE_SIGNAME})

message(STATUS "HAVE_BACKTRACE: " ${HAVE_BACKTRACE})

message(STATUS "CHECK_WORKING: " ${CHECK_WORKING})
message(STATUS "CHECK_FOUND: " ${CHECK_FOUND})
2 changes: 0 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
include_directories(${include_directories} CHECK_INCLUDES)

add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND})

add_subdirectory(array)
add_subdirectory(bstring)
add_subdirectory(buffer)
Expand Down
1 change: 0 additions & 1 deletion test/array/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/bstring/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/buffer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/channel/pipe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/channel/tcp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/event/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/log/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ if(OS_PLATFORM STREQUAL "OS_DARWIN")
set_target_properties(${test_name} PROPERTIES LINK_FLAGS "-Wl,-F/System/Library/Frameworks")
endif()

add_dependencies(check ${test_name} ccommon-static)
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/metric/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/option/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/pool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/rbuf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/ring_array/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/time/timer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})
1 change: 0 additions & 1 deletion test/time/wheel/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,4 @@ set(source check_${suite}.c)
add_executable(${test_name} ${source})
target_link_libraries(${test_name} ccommon-static ${CHECK_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} m)

add_dependencies(check ${test_name})
add_test(${test_name} ${test_name})

0 comments on commit 97d9cd3

Please sign in to comment.