-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathruntest.cmake
More file actions
executable file
·40 lines (35 loc) · 1.35 KB
/
runtest.cmake
File metadata and controls
executable file
·40 lines (35 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
##########################################################################
# Step 1. Run the input file and check if it executes successfully
#
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${TEST_PROG} Testing/input/${TEST_NAME}.i
RESULT_VARIABLE EXE_HAD_ERROR
)
if(EXE_HAD_ERROR)
message(FATAL_ERROR "Test failed to run, i.e., exit value != 0")
endif()
##########################################################################
# Step 2. Check if the output files are (numerically) the same as expected
# Will check two time stamps
# 2.1 First time stamp
message("Now check the first time stamp at N = ${STEP_1}")
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_SOURCE_DIR}/vtk_diff.py output/${TEST_NAME}_step_${STEP_1}.vtu Testing/expected/${TEST_NAME}_step_${STEP_1}.vtu
RESULT_VARIABLE FILES_ARE_DIFF
)
if(FILES_ARE_DIFF)
message(FATAL_ERROR "TEST FAILED - files are different.")
endif()
# 2.2 Second time stamp
message("") # an empty line
message("Now check the second time stamp at N = ${STEP_2}")
EXECUTE_PROCESS(
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND ${CMAKE_SOURCE_DIR}/vtk_diff.py output/${TEST_NAME}_step_${STEP_2}.vtu Testing/expected/${TEST_NAME}_step_${STEP_2}.vtu
RESULT_VARIABLE FILES_ARE_DIFF
)
if(FILES_ARE_DIFF)
message(FATAL_ERROR "TEST FAILED - files are different.")
endif()