]> git.proxmox.com Git - ceph.git/blame - ceph/cmake/modules/AddCephTest.cmake
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / cmake / modules / AddCephTest.cmake
CommitLineData
7c673cae
FG
1#AddCephTest is a module for adding tests to the "make check" target which runs CTest
2
3#adds makes target/script into a test, test to check target, sets necessary environment variables
4function(add_ceph_test test_name test_path)
5 add_test(NAME ${test_name} COMMAND ${test_path} ${ARGN})
6 add_dependencies(tests ${test_name})
7 set_property(TEST
8 ${test_name}
9 PROPERTY ENVIRONMENT
10 CEPH_ROOT=${CMAKE_SOURCE_DIR}
11 CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
12 CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
13 CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
14 LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib
15 PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src:$ENV{PATH}
16 PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cython_modules/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR}:${CMAKE_SOURCE_DIR}/src/pybind
17 CEPH_BUILD_VIRTUALENV=${CEPH_BUILD_VIRTUALENV})
18 # none of the tests should take more than 1 hour to complete
19 set_property(TEST
20 ${test_name}
21 PROPERTY TIMEOUT 3600)
22endfunction()
23
24#sets uniform compiler flags and link libraries
25function(add_ceph_unittest unittest_name unittest_path)
26 add_ceph_test(${unittest_name} ${unittest_path})
27 target_link_libraries(${unittest_name} ${UNITTEST_LIBS})
28 set_target_properties(${unittest_name} PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS})
29endfunction()
30