Skip to content
Snippets Groups Projects
Unverified Commit 20226319 authored by Joris Vaillant's avatar Joris Vaillant
Browse files

cmake: Prefix all test target by eigenpy-

parent eab7eed3
No related branches found
No related tags found
No related merge requests found
...@@ -2,31 +2,32 @@ ...@@ -2,31 +2,32 @@
# Copyright (c) 2014-2019 CNRS Copyright (c) 2018-2024 INRIA # Copyright (c) 2014-2019 CNRS Copyright (c) 2018-2024 INRIA
# #
macro(ADD_LIB_UNIT_TEST test) function(ADD_LIB_UNIT_TEST test)
create_ctest_build_tests_target() create_ctest_build_tests_target()
set(test_target ${PROJECT_NAME}-${test})
if(BUILD_TESTING) if(BUILD_TESTING)
add_library(${test} SHARED "${test}.cpp") add_library(${test_target} SHARED "${test}.cpp")
else(BUILD_TESTING) else(BUILD_TESTING)
add_library(${test} SHARED EXCLUDE_FROM_ALL "${test}.cpp") add_library(${test_target} SHARED EXCLUDE_FROM_ALL "${test}.cpp")
endif(BUILD_TESTING) endif(BUILD_TESTING)
set_standard_output_directory(${test}) set_standard_output_directory(${test_target})
target_link_libraries(${test} PUBLIC ${PROJECT_NAME}) target_link_libraries(${test_target} PUBLIC ${PROJECT_NAME})
set_target_properties(${test} PROPERTIES PREFIX "") set_target_properties(${test_target} PROPERTIES PREFIX "")
set_target_properties(${test} PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX}) set_target_properties(${test_target} PROPERTIES SUFFIX ${PYTHON_EXT_SUFFIX})
add_test( add_test(
NAME ${test} NAME ${test_target}
COMMAND ${PYTHON_EXECUTABLE} -c "import ${test}" COMMAND ${PYTHON_EXECUTABLE} -c "import ${test}"
WORKING_DIRECTORY $<TARGET_FILE_DIR:${test}>) WORKING_DIRECTORY $<TARGET_FILE_DIR:${test_target}>)
add_dependencies(build_tests ${test}) add_dependencies(build_tests ${test_target})
if(NOT BUILD_TESTING) if(NOT BUILD_TESTING)
set_tests_properties(${test} PROPERTIES DEPENDS ctest_build_tests) set_tests_properties(${test_target} PROPERTIES DEPENDS ctest_build_tests)
endif(NOT BUILD_TESTING) endif(NOT BUILD_TESTING)
endmacro(ADD_LIB_UNIT_TEST) endfunction()
add_dependencies(build_tests ${PYWRAP}) add_dependencies(build_tests ${PYWRAP})
add_lib_unit_test(matrix) add_lib_unit_test(matrix)
...@@ -58,17 +59,20 @@ if(CMAKE_CXX_STANDARD GREATER 14 AND CMAKE_CXX_STANDARD LESS 98) ...@@ -58,17 +59,20 @@ if(CMAKE_CXX_STANDARD GREATER 14 AND CMAKE_CXX_STANDARD LESS 98)
endif() endif()
function(add_python_lib_unit_test name source) function(add_python_lib_unit_test name source)
add_python_unit_test(${name} ${source} "lib" "bin") set(test_target ${PROJECT_NAME}-${name})
add_python_unit_test(${test_target} ${source} "lib" "bin")
endfunction() endfunction()
function(add_python_eigenpy_lib_unit_test name source) function(add_python_eigenpy_lib_unit_test name source)
add_python_unit_test(${name} ${source} "lib" "bin" "python") set(test_target ${PROJECT_NAME}-${name})
set_tests_properties(${name} PROPERTIES DEPENDS ${PYWRAP}) add_python_unit_test(${test_target} ${source} "lib" "bin" "python")
set_tests_properties(${test_target} PROPERTIES DEPENDS ${PYWRAP})
endfunction() endfunction()
function(add_python_eigenpy_unit_test name source) function(add_python_eigenpy_unit_test name source)
add_python_unit_test(${name} ${source} "python") set(test_target ${PROJECT_NAME}-${name})
set_tests_properties(${name} PROPERTIES DEPENDS ${PYWRAP}) add_python_unit_test(${test_target} ${source} "python")
set_tests_properties(${test_target} PROPERTIES DEPENDS ${PYWRAP})
endfunction() endfunction()
function(config_test test tagname opttype) function(config_test test tagname opttype)
...@@ -80,7 +84,7 @@ function(config_test test tagname opttype) ...@@ -80,7 +84,7 @@ function(config_test test tagname opttype)
configure_file(python/test_${test}.py.in configure_file(python/test_${test}.py.in
${CMAKE_CURRENT_BINARY_DIR}/python/${py_file}) ${CMAKE_CURRENT_BINARY_DIR}/python/${py_file})
add_lib_unit_test(${MODNAME}) add_lib_unit_test(${MODNAME})
set(PYTHON_TEST_NAME "py-${test}-${tagname}") set(PYTHON_TEST_NAME "${PROJECT_NAME}-py-${test}-${tagname}")
add_test(NAME ${PYTHON_TEST_NAME} add_test(NAME ${PYTHON_TEST_NAME}
COMMAND ${PYTHON_EXECUTABLE} COMMAND ${PYTHON_EXECUTABLE}
"${CMAKE_CURRENT_BINARY_DIR}/python/${py_file}") "${CMAKE_CURRENT_BINARY_DIR}/python/${py_file}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment