Medical Imaging Interaction Toolkit  2018.4.99-389bf124
Medical Imaging Interaction Toolkit
mitkFunctionAddCustomModuleTest.cmake
Go to the documentation of this file.
1 #!
2 #! \brief Add a custom test for MITK module
3 #!
4 #! \param test_name Unique identifier for the test
5 #! \param test_function Name of the test function (the one with the argc,argv signature)
6 #!
7 #! Additional parameters will be passed as command line parameters to the test.
8 #!
9 function(mitkAddCustomModuleTest test_name test_function)
10 
11  if (BUILD_TESTING AND MODULE_IS_ENABLED)
12  if(MITK_XVFB_TESTING)
13  set(xvfb_run "xvfb-run" "--auto-servernum")
14  else()
15  set(xvfb_run )
16  endif()
17  add_test(NAME ${test_name} COMMAND ${xvfb_run} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${test_function} ${ARGN})
18  set_property(TEST ${test_name} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK)
19  mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_RELEASE release RELEASE)
20  mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_DEBUG debug DEBUG)
21  set(test_env_path ${MITK_RUNTIME_PATH_RELEASE} ${MITK_RUNTIME_PATH_DEBUG} $ENV{PATH})
22  list(REMOVE_DUPLICATES test_env_path)
23  string (REGEX REPLACE "\;" "\\\;" test_env_path "${test_env_path}")
24  set_property(TEST ${test_name} PROPERTY ENVIRONMENT "PATH=${test_env_path}" APPEND)
25  set_property(TEST ${test_name} PROPERTY SKIP_RETURN_CODE 77)
26  endif()
27 
28 endfunction()
mitkFunctionGetLibrarySearchPaths(search_path, intermediate_dir)
mitkAddCustomModuleTest(test_name, test_function)
Add a custom test for MITK module.
#define BUILD_TESTING
const std::string NAME