Skip to content
Snippets Groups Projects
Commit 5b9bf5af authored by Lars Bilke's avatar Lars Bilke
Browse files

Disable tests if a requirement is not met instead of aborting CMake.

parent 751ec970
No related branches found
No related tags found
No related merge requests found
...@@ -59,18 +59,18 @@ function (AddTest) ...@@ -59,18 +59,18 @@ function (AddTest)
# --- Implement wrappers --- # --- Implement wrappers ---
# check requirements # check requirements, disable if not met
if(AddTest_WRAPPER STREQUAL "time" AND NOT TIME_TOOL_PATH) if(AddTest_WRAPPER STREQUAL "time" AND NOT TIME_TOOL_PATH)
message(FATAL_ERROR "time-command is required for time wrapper but was not found!") return()
endif() endif()
if(AddTest_WRAPPER STREQUAL "memcheck" AND NOT VALGRIND_TOOL_PATH) if(AddTest_WRAPPER STREQUAL "memcheck" AND NOT VALGRIND_TOOL_PATH)
message(FATAL_ERROR "Valgrind is required for memcheck wrapper but was not found!") return()
endif() endif()
if(AddTest_WRAPPER STREQUAL "callgrind" AND NOT VALGRIND_TOOL_PATH) if(AddTest_WRAPPER STREQUAL "callgrind" AND NOT VALGRIND_TOOL_PATH)
message(FATAL_ERROR "Valgrind is required for callgrind wrapper but was not found!") return()
endif() endif()
if(AddTest_WRAPPER STREQUAL "mpirun" AND NOT MPIRUN_TOOL_PATH) if(AddTest_WRAPPER STREQUAL "mpirun" AND NOT MPIRUN_TOOL_PATH)
message(FATAL_ERROR "mpirun is required for mpirun wrapper but was not found!") return()
endif() endif()
if(AddTest_WRAPPER STREQUAL "time") if(AddTest_WRAPPER STREQUAL "time")
...@@ -86,19 +86,20 @@ function (AddTest) ...@@ -86,19 +86,20 @@ function (AddTest)
endif() endif()
# --- Implement testers --- # --- Implement testers ---
# check requirements # check requirements, disable if not met
if(AddTest_TESTER STREQUAL "diff" AND NOT DIFF_TOOL_PATH) if(AddTest_TESTER STREQUAL "diff" AND NOT DIFF_TOOL_PATH)
message(FATAL_ERROR "diff-command is required for diff tester but was not found!") return()
endif() endif()
if(AddTest_TESTER STREQUAL "numdiff" AND NOT NUMDIFF_TOOL_PATH) if(AddTest_TESTER STREQUAL "numdiff" AND NOT NUMDIFF_TOOL_PATH)
message(FATAL_ERROR "numdiff-command is required for numdiff tester but was not found!") return()
endif() endif()
if(AddTest_TESTER STREQUAL "memcheck" AND NOT GREP_TOOL_PATH)
return()
endif()
if((AddTest_TESTER STREQUAL "diff" OR AddTest_TESTER STREQUAL "numdiff") AND NOT AddTest_DIFF_DATA) if((AddTest_TESTER STREQUAL "diff" OR AddTest_TESTER STREQUAL "numdiff") AND NOT AddTest_DIFF_DATA)
message(FATAL_ERROR "AddTest(): ${AddTest_NAME} - no DIFF_DATA given!") message(FATAL_ERROR "AddTest(): ${AddTest_NAME} - no DIFF_DATA given!")
endif() endif()
if(AddTest_TESTER STREQUAL "memcheck" AND NOT GREP_TOOL_PATH)
message(FATAL_ERROR "grep-command is required for memcheck tester but was not found!")
endif()
if(AddTest_TESTER STREQUAL "diff") if(AddTest_TESTER STREQUAL "diff")
set(SELECTED_DIFF_TOOL_PATH ${DIFF_TOOL_PATH}) set(SELECTED_DIFF_TOOL_PATH ${DIFF_TOOL_PATH})
......
...@@ -8,6 +8,28 @@ FIND_PROGRAM(BASH_TOOL_PATH bash) ...@@ -8,6 +8,28 @@ FIND_PROGRAM(BASH_TOOL_PATH bash)
FIND_PROGRAM(VALGRIND_TOOL_PATH valgrind) FIND_PROGRAM(VALGRIND_TOOL_PATH valgrind)
FIND_PROGRAM(MPIRUN_TOOL_PATH mpirun) FIND_PROGRAM(MPIRUN_TOOL_PATH mpirun)
if(NOT TIME_TOOL_PATH)
message(STATUS "time-command is required for time wrapper but was not found! All corresponding tests are disabled.")
endif()
if(NOT VALGRIND_TOOL_PATH)
message(STATUS "Valgrind is required for memcheck wrapper but was not found! All corresponding tests are disabled.")
endif()
if(NOT VALGRIND_TOOL_PATH)
message(STATUS "Valgrind is required for callgrind wrapper but was not found! All corresponding tests are disabled.")
endif()
if(NOT MPIRUN_TOOL_PATH)
message(STATUS "mpirun is required for mpirun wrapper but was not found! All corresponding tests are disabled.")
endif()
if(NOT DIFF_TOOL_PATH)
message(STATUS "diff-command is required for diff tester but was not found! All corresponding tests are disabled.")
endif()
if(NOT NUMDIFF_TOOL_PATH)
message(STATUS "numdiff-command is required for numdiff tester but was not found! All corresponding tests are disabled.")
endif()
if(NOT GREP_TOOL_PATH)
message(STATUS "grep-command is required for memcheck tester but was not found! All corresponding tests are disabled.")
endif()
ENABLE_TESTING() # Enable CTest ENABLE_TESTING() # Enable CTest
# See http://www.vtk.org/Wiki/CMake/Testing_With_CTest for some customization options # See http://www.vtk.org/Wiki/CMake/Testing_With_CTest for some customization options
......
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