build: add a 'util_test' target

This commit is contained in:
Danny Robson 2019-05-24 10:58:32 +10:00
parent f3e0744e18
commit 19409d67ca

View File

@ -690,6 +690,8 @@ if (TESTS)
) )
endif() endif()
add_custom_target(util_test)
foreach(t ${TEST_BIN}) foreach(t ${TEST_BIN})
string(REPLACE "/" "_" name "test/${t}") string(REPLACE "/" "_" name "test/${t}")
add_executable(util_${name} test/${t}.cpp) add_executable(util_${name} test/${t}.cpp)
@ -697,12 +699,14 @@ if (TESTS)
target_include_directories(util_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) target_include_directories(util_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
add_test(NAME util_${name} COMMAND util_${name}) add_test(NAME util_${name} COMMAND util_${name})
set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
add_dependencies(util_test util_${name})
endforeach(t) endforeach(t)
configure_file (test/cpp.py.in util_test_cpp.py @ONLY) configure_file (test/cpp.py.in util_test_cpp.py @ONLY)
add_test (NAME util_test_cpp COMMAND ${PYTHON_EXECUTABLE} util_test_cpp.py) add_test (NAME util_test_cpp COMMAND ${PYTHON_EXECUTABLE} util_test_cpp.py)
set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro) set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro)
set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
endif () endif ()