2016-01-26 20:45:15 +00:00
|
|
|
#AddCephTest is a module for adding tests to the "make check" target which runs CTest
|
|
|
|
|
|
|
|
#adds makes target/script into a test, test to check target, sets necessary environment variables
|
|
|
|
function(add_ceph_test test_name test_path)
|
2016-07-26 20:23:52 +00:00
|
|
|
add_test(NAME ${test_name} COMMAND ${test_path} ${ARGN})
|
2016-07-13 13:14:30 +00:00
|
|
|
add_dependencies(tests ${test_name})
|
|
|
|
set_property(TEST
|
2016-01-26 20:45:15 +00:00
|
|
|
${test_name}
|
|
|
|
PROPERTY ENVIRONMENT
|
|
|
|
CEPH_ROOT=${CMAKE_SOURCE_DIR}
|
|
|
|
CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
|
|
|
|
CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
|
2016-01-26 20:32:05 +00:00
|
|
|
CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
|
2016-01-26 20:45:15 +00:00
|
|
|
LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib
|
|
|
|
PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src:$ENV{PATH}
|
2016-07-13 12:57:30 +00:00
|
|
|
PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cython_modules/lib.${PYTHON${PYTHON_VERSION}_VERSION_MAJOR}:${CMAKE_SOURCE_DIR}/src/pybind
|
2016-05-10 13:50:17 +00:00
|
|
|
CEPH_BUILD_VIRTUALENV=${CEPH_BUILD_VIRTUALENV})
|
2016-07-14 07:59:14 +00:00
|
|
|
# none of the tests should take more than 1 hour to complete
|
|
|
|
set_property(TEST
|
|
|
|
${test_name}
|
|
|
|
PROPERTY TIMEOUT 3600)
|
2016-01-26 20:45:15 +00:00
|
|
|
endfunction()
|
|
|
|
|
|
|
|
#sets uniform compiler flags and link libraries
|
2017-10-03 13:15:50 +00:00
|
|
|
function(add_ceph_unittest unittest_name)
|
|
|
|
add_ceph_test(${unittest_name} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${unittest_name})
|
2016-01-26 20:45:15 +00:00
|
|
|
target_link_libraries(${unittest_name} ${UNITTEST_LIBS})
|
|
|
|
set_target_properties(${unittest_name} PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS})
|
|
|
|
endfunction()
|
|
|
|
|