move tests to separate dir
create macro "pip_test()" for easily add new tests
This commit is contained in:
@@ -3,7 +3,7 @@ cmake_policy(SET CMP0017 NEW) # need include() with .cmake
|
|||||||
project(pip)
|
project(pip)
|
||||||
set(_PIP_MAJOR 1)
|
set(_PIP_MAJOR 1)
|
||||||
set(_PIP_MINOR 99)
|
set(_PIP_MINOR 99)
|
||||||
set(_PIP_REVISION 1)
|
set(_PIP_REVISION 2)
|
||||||
set(_PIP_SUFFIX _prebeta)
|
set(_PIP_SUFFIX _prebeta)
|
||||||
set(_PIP_COMPANY SHS)
|
set(_PIP_COMPANY SHS)
|
||||||
set(_PIP_DOMAIN org.SHS)
|
set(_PIP_DOMAIN org.SHS)
|
||||||
@@ -98,11 +98,7 @@ set(PIP_OPENCL "no")
|
|||||||
set(PIP_LUA "no")
|
set(PIP_LUA "no")
|
||||||
set(PIP_IOUTILS "yes")
|
set(PIP_IOUTILS "yes")
|
||||||
set(PIP_UTILS_LIST)
|
set(PIP_UTILS_LIST)
|
||||||
|
set(PIP_TESTS_LIST)
|
||||||
if (TESTS)
|
|
||||||
include(DownloadGTest)
|
|
||||||
set(PIP_CONCURRENT_TEST "lib/concurrent/test")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
|
if (DEFINED ENV{QNX_HOST} OR PIP_FREERTOS)
|
||||||
set(STATIC_LIB ON)
|
set(STATIC_LIB ON)
|
||||||
@@ -199,6 +195,11 @@ foreach(F ${PIP_FOLDERS})
|
|||||||
include_directories("${PIP_SRC_MAIN}/${F}")
|
include_directories("${PIP_SRC_MAIN}/${F}")
|
||||||
gather_src("${PIP_SRC_MAIN}/${F}" CPP_LIB_MAIN HDRS PHDRS)
|
gather_src("${PIP_SRC_MAIN}/${F}" CPP_LIB_MAIN HDRS PHDRS)
|
||||||
endforeach(F)
|
endforeach(F)
|
||||||
|
|
||||||
|
if (TESTS)
|
||||||
|
add_subdirectory(tests)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Crypt lib
|
# Crypt lib
|
||||||
gather_src("${PIP_SRC_CRYPT}" CPP_LIB_CRYPT HDRS PHDRS)
|
gather_src("${PIP_SRC_CRYPT}" CPP_LIB_CRYPT HDRS PHDRS)
|
||||||
|
|
||||||
@@ -226,11 +227,6 @@ gather_src("${PIP_SRC_CLOUD}" CPP_LIB_CLOUD HDRS PHDRS)
|
|||||||
# LUA lib
|
# LUA lib
|
||||||
gather_src("${PIP_SRC_LUA}" CPP_LIB_LUA HDRS PHDRS)
|
gather_src("${PIP_SRC_LUA}" CPP_LIB_LUA HDRS PHDRS)
|
||||||
|
|
||||||
if (TESTS)
|
|
||||||
# Concurrent lib tests
|
|
||||||
gather_src("${PIP_CONCURRENT_TEST}" CPP_CONCURRENT_TEST HDRS PHDRS)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(PIP_FREERTOS)
|
if(PIP_FREERTOS)
|
||||||
add_definitions(-DPIP_FREERTOS)
|
add_definitions(-DPIP_FREERTOS)
|
||||||
set(ICU OFF)
|
set(ICU OFF)
|
||||||
@@ -579,15 +575,6 @@ if (NOT CROSSTOOLS)
|
|||||||
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
list(APPEND PIP_LIBS_TARGETS pip_io_utils)
|
||||||
|
|
||||||
|
|
||||||
# Enable build tests for concurrent module
|
|
||||||
if(PIP_CONCURRENT_TEST)
|
|
||||||
add_executable(pip_concurrent_test ${CPP_CONCURRENT_TEST})
|
|
||||||
target_link_libraries(pip_concurrent_test pip gtest_main gmock_main)
|
|
||||||
add_test(NAME pip_concurrent_test COMMAND tests)
|
|
||||||
add_custom_target(pip_concurrent_test_perform ALL COMMAND pip_concurrent_test)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Build cloud library if crypt enabled
|
# Build cloud library if crypt enabled
|
||||||
if(sodium_FOUND)
|
if(sodium_FOUND)
|
||||||
import_version(pip_cloud pip)
|
import_version(pip_cloud pip)
|
||||||
@@ -800,6 +787,13 @@ message(" OpenCL : ${PIP_OPENCL}")
|
|||||||
message(" IOUtils : ${PIP_IOUTILS}")
|
message(" IOUtils : ${PIP_IOUTILS}")
|
||||||
message(" Cloud : ${PIP_CLOUD}")
|
message(" Cloud : ${PIP_CLOUD}")
|
||||||
message(" Lua : ${PIP_LUA}")
|
message(" Lua : ${PIP_LUA}")
|
||||||
|
if (PIP_TESTS_LIST)
|
||||||
|
message("")
|
||||||
|
message(" Tests:")
|
||||||
|
foreach(_test ${PIP_TESTS_LIST})
|
||||||
|
message(" * ${_test}")
|
||||||
|
endforeach()
|
||||||
|
endif()
|
||||||
message("")
|
message("")
|
||||||
message(" Utilites:")
|
message(" Utilites:")
|
||||||
foreach(_util ${PIP_UTILS_LIST})
|
foreach(_util ${PIP_UTILS_LIST})
|
||||||
|
|||||||
15
tests/CMakeLists.txt
Normal file
15
tests/CMakeLists.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
include(DownloadGTest)
|
||||||
|
|
||||||
|
macro(pip_test NAME LIBS)
|
||||||
|
gather_src("${NAME}" CPP_${NAME}_TEST _T_H _T_PH)
|
||||||
|
set(_target pip_${NAME}_test)
|
||||||
|
add_executable(${_target} ${CPP_${NAME}_TEST})
|
||||||
|
target_link_libraries(${_target} pip ${LIBS} gtest_main gmock_main)
|
||||||
|
add_test(NAME ${_target} COMMAND tests)
|
||||||
|
add_custom_target(${_target}_perform ALL COMMAND ${_target})
|
||||||
|
list(APPEND PIP_TESTS_LIST "${NAME}")
|
||||||
|
set(PIP_TESTS_LIST ${PIP_TESTS_LIST} PARENT_SCOPE)
|
||||||
|
endmacro()
|
||||||
|
|
||||||
|
# Concurrent tests
|
||||||
|
pip_test(concurrent "")
|
||||||
Reference in New Issue
Block a user