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

[CMake] Possibility to don't specify a test wrapper.

When there is no wrapper specified then there simply is no wrapper
which results in a no-op.

This enables ctest on Windows and fixes #1403.

time-Wrapper can still be used!
parent cbc7c6b5
No related branches found
No related tags found
No related merge requests found
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
### Features: ### Features:
### Utilities ### Utilities
### Infrastructure: ### Infrastructure:
- ctest now works on Windows too by removing time-wrappers
### Fixes: ### Fixes:
# 6.0.7 # 6.0.7
......
...@@ -9,10 +9,9 @@ ...@@ -9,10 +9,9 @@
# PATH <working directory> # relative to SourceDir/Tests/Data # PATH <working directory> # relative to SourceDir/Tests/Data
# EXECUTABLE <executable target> # optional, defaults to ogs # EXECUTABLE <executable target> # optional, defaults to ogs
# EXECUTABLE_ARGS <arguments> # EXECUTABLE_ARGS <arguments>
# WRAPPER <time|memcheck|callgrind> # optional, defaults to time # WRAPPER <time|memcheck|callgrind> # optional
# WRAPPER_ARGS <arguments> # optional # WRAPPER_ARGS <arguments> # optional
# TESTER <diff|memcheck> # optional # TESTER <diff|vtkdiff|memcheck> # optional
# DATA <list of all required data files, white-space separated, have to be in PATH>
# ) # )
# #
# Conditional arguments: # Conditional arguments:
...@@ -53,16 +52,11 @@ function (AddTest) ...@@ -53,16 +52,11 @@ function (AddTest)
if (NOT AddTest_RELTOL) if (NOT AddTest_RELTOL)
set (AddTest_RELTOL 1e-16) set (AddTest_RELTOL 1e-16)
endif() endif()
# message("AddTest_ABSTOL ${AddTest_ABSTOL}")
if("${AddTest_EXECUTABLE}" STREQUAL "ogs") if("${AddTest_EXECUTABLE}" STREQUAL "ogs")
set(AddTest_EXECUTABLE_ARGS -o ${AddTest_BINARY_PATH_NATIVE} ${AddTest_EXECUTABLE_ARGS}) set(AddTest_EXECUTABLE_ARGS -o ${AddTest_BINARY_PATH_NATIVE} ${AddTest_EXECUTABLE_ARGS})
endif() endif()
if(NOT AddTest_WRAPPER)
set(AddTest_WRAPPER time)
endif()
# --- Implement wrappers --- # --- Implement wrappers ---
# check requirements, disable if not met # 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)
...@@ -172,8 +166,12 @@ function (AddTest) ...@@ -172,8 +166,12 @@ function (AddTest)
endforeach() endforeach()
# Run the wrapper # Run the wrapper
if(DEFINED AddTest_WRAPPER)
set(AddTest_WRAPPER_STRING "-${AddTest_WRAPPER}")
endif()
set(TEST_NAME "${AddTest_EXECUTABLE}-${AddTest_NAME}${AddTest_WRAPPER_STRING}")
add_test( add_test(
NAME "${AddTest_EXECUTABLE}-${AddTest_NAME}-${AddTest_WRAPPER}" NAME ${TEST_NAME}
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-DEXECUTABLE=${AddTest_EXECUTABLE_PARSED} -DEXECUTABLE=${AddTest_EXECUTABLE_PARSED}
"-DEXECUTABLE_ARGS=${AddTest_EXECUTABLE_ARGS}" "-DEXECUTABLE_ARGS=${AddTest_EXECUTABLE_ARGS}"
...@@ -195,14 +193,14 @@ function (AddTest) ...@@ -195,14 +193,14 @@ function (AddTest)
endif() endif()
# Run the tester # Run the tester
set(TESTER_NAME "${TEST_NAME}-${AddTest_TESTER}")
add_test( add_test(
NAME "${AddTest_EXECUTABLE}-${AddTest_NAME}-${AddTest_WRAPPER}-${AddTest_TESTER}" NAME ${TESTER_NAME}
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
-Dcase_path=${AddTest_SOURCE_PATH} -Dcase_path=${AddTest_SOURCE_PATH}
-DTESTER_COMMAND=${TESTER_COMMAND} -DTESTER_COMMAND=${TESTER_COMMAND}
-P ${PROJECT_SOURCE_DIR}/scripts/cmake/test/AddTestTester.cmake -P ${PROJECT_SOURCE_DIR}/scripts/cmake/test/AddTestTester.cmake
) )
set_tests_properties(${AddTest_EXECUTABLE}-${AddTest_NAME}-${AddTest_WRAPPER}-${AddTest_TESTER} set_tests_properties(${TESTER_NAME} PROPERTIES DEPENDS ${TEST_NAME})
PROPERTIES DEPENDS ${AddTest_EXECUTABLE}-${AddTest_NAME}-${AddTest_WRAPPER})
endfunction() endfunction()
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