2 # Create tests and testdriver for this module
4 # Usage: MITK_CREATE_MODULE_TESTS( [EXTRA_DRIVER_INIT init_code] )
6 # EXTRA_DRIVER_INIT is inserted as c++ code in the testdriver and will be executed before each test
9 cmake_parse_arguments(MODULE_TEST
10 "US_MODULE;NO_INIT" "EXTRA_DRIVER_INIT;EXTRA_DRIVER_INCLUDE" "EXTRA_DEPENDS;DEPENDS;PACKAGE_DEPENDS" ${ARGN})
12 if(BUILD_TESTING AND MODULE_IS_ENABLED)
14 include_directories(.)
16 set(TESTDRIVER ${MODULE_NAME}TestDriver)
18 set(MODULE_TEST_EXTRA_DRIVER_INIT
"${MODULE_TEST_EXTRA_DRIVER_INIT}")
20 if(MODULE_TEST_US_MODULE)
21 message(WARNING "The US_MODULE argument is deprecated and should be removed")
24 if(MODULE_TEST_US_MODULE AND MODULE_TEST_NO_INIT)
25 message(WARNING "Conflicting arguments US_MODULE and NO_INIT: NO_INIT wins.")
29 if(MODULE_TEST_NO_INIT)
33 set(MITK_MODULE_NAME_REGEX_MATCH )
34 set(MITK_MODULE_NAME_REGEX_NOT_MATCH )
36 set(_testdriver_file_list ${CMAKE_CURRENT_BINARY_DIR}/testdriver_files.cmake)
37 configure_file(${MITK_CMAKE_DIR}/mitkTestDriverFiles.cmake.in ${_testdriver_file_list} @ONLY)
39 DEPENDS ${MODULE_NAME} ${MODULE_TEST_DEPENDS} ${MODULE_TEST_EXTRA_DEPENDS} MitkTestingHelper
40 PACKAGE_DEPENDS ${MODULE_TEST_PACKAGE_DEPENDS}
41 SUBPROJECTS ${MODULE_SUBPROJECTS}
42 FILES_CMAKE ${_testdriver_file_list}
43 NO_FEATURE_INFO NO_BATCH_FILE ${_no_init})
46 # Now tell
CMake which tests should be run. This is done automatically
47 #
for all tests
in ${KITNAME}_TESTS and ${KITNAME}_IMAGE_TESTS. The IMAGE_TESTS
48 # are run for each image in the TESTIMAGES list.
51 foreach(
test ${MODULE_TESTS} )
52 get_filename_component(TName ${
test} NAME_WE)
53 add_test(${TName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName})
54 # Add labels
for CDash subproject support
55 if(MODULE_SUBPROJECTS)
56 set_property(TEST ${TName} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
60 set(TEST_TYPES IMAGE SURFACE POINTSET)
# add other file types here
62 foreach(test_type ${TEST_TYPES})
63 foreach(test_data ${MODULE_TEST${test_type}} ${ADDITIONAL_TEST_${test_type}})
64 if(EXISTS ${test_data})
65 set(TEST_DATA_FULL_PATH ${test_data})
67 # todo: maybe search other paths as well
68 # yes, please in mitk/Testing/Data, too
72 if(EXISTS ${TEST_DATA_FULL_PATH})
73 foreach(
test ${MODULE_${test_type}_TESTS})
74 get_filename_component(TName ${
test} NAME_WE)
75 get_filename_component(DName ${TEST_DATA_FULL_PATH}
NAME)
76 add_test(${TName}_${DName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName} ${TEST_DATA_FULL_PATH})
77 # Add labels
for CDash subproject support
78 if(MODULE_SUBPROJECTS)
79 set_property(TEST ${TName}_${DName} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
83 message("!!!!! No such file: ${TEST_DATA_FULL_PATH} !!!!!
")
MITK_CREATE_MODULE_TESTS()
Follow Up Storage - Class to facilitate loading/accessing structured follow-up data.
static bool in(Reader::Char c, Reader::Char c1, Reader::Char c2, Reader::Char c3, Reader::Char c4)