Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ endif()

project("ML")

include(CTest)

include(CheckPIESupported)
check_pie_supported()

Expand Down
30 changes: 23 additions & 7 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,9 @@ function(ml_add_test_executable _target)

target_link_libraries(ml_test_${_target} ${ML_LINK_LIBRARIES})

add_test(ml_test_${_target} ml_test_${_target})
add_test(NAME ml_test_${_target} COMMAND ml_test_${_target}
--logger=JUNIT,warning,${CMAKE_CURRENT_BINARY_DIR}/ml_test_${_target}_junit.xml
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})

get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)

Expand All @@ -392,14 +394,28 @@ function(ml_add_test_executable _target)
COMMENT "Running test: ml_test_${_target}"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endif()

add_custom_target(test_${_target}_individually
DEPENDS ml_test_${_target}
COMMAND ${CMAKE_SOURCE_DIR}/run_tests_as_seperate_processes.sh ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} test_${_target}
COMMENT "Running test: ml_test_${_target}_individually"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
set(_individually_commands "")
if(isMultiConfig)
set(_individually_commands
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/ml_test_${_target}${CMAKE_EXECUTABLE_SUFFIX}
${CMAKE_CURRENT_BINARY_DIR}/ml_test_${_target}${CMAKE_EXECUTABLE_SUFFIX})
endif()

add_custom_target(test_${_target}_individually
DEPENDS ml_test_${_target}
${_individually_commands}
COMMAND ${CMAKE_COMMAND}
-DBINARY_DIR=${CMAKE_CURRENT_BINARY_DIR}
-DTEST_SUITE=test_${_target}
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-DSOURCE_DIR=${CMAKE_SOURCE_DIR}
-P ${CMAKE_SOURCE_DIR}/cmake/run-tests-individually.cmake
COMMENT "Running test: ml_test_${_target}_individually"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
endfunction()

function(ml_codesign _target)
Expand Down
Loading