ceph/cmake/modules/AddCephTest.cmake
Ali Maredia 65963739cd cmake: ceph_objectstore_tool.py test passing
Replaced relative paths in shell scripts in
test/ceph_objectstore_tool.py and init-ceph.in to
work with CEPH_FOO environment variables set in cmake.
Also added CEPH_BUILD_DIR environment variable set
to CMAKE_BINARY_DIR. It is used in init-ceph and
ceph_objectstore_tool.py.

Signed-off-by: Ali Maredia <amaredia@redhat.com>
2016-04-14 20:48:21 -04:00

26 lines
1.1 KiB
CMake

#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)
add_test(NAME ${test_name} COMMAND ${test_path})
add_dependencies(check ${test_name})
set_property(TEST
${test_name}
PROPERTY ENVIRONMENT
CEPH_ROOT=${CMAKE_SOURCE_DIR}
CEPH_BIN=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}
CEPH_LIB=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib
PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src:$ENV{PATH}
PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cython_modules/lib.linux-x86_64-2.7:${CMAKE_SOURCE_DIR}/src/pybind)
endfunction()
#sets uniform compiler flags and link libraries
function(add_ceph_unittest unittest_name unittest_path)
add_ceph_test(${unittest_name} ${unittest_path})
target_link_libraries(${unittest_name} ${UNITTEST_LIBS})
set_target_properties(${unittest_name} PROPERTIES COMPILE_FLAGS ${UNITTEST_CXX_FLAGS})
endfunction()