mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-01-24 05:16:27 -06:00
Added regression tests for comparing ECLfiles using CTest
This commit is contained in:
parent
8be4cc9295
commit
fc9251bd4f
@ -156,4 +156,7 @@ if (HAVE_OPM_DATA)
|
||||
opm_add_python_test( check_INIT_NORNE ${PROJECT_SOURCE_DIR}/tests/compare_INIT.py $<TARGET_FILE:flow> ${OPM_DATA_ROOT}/norne/NORNE_ATW2013.DATA ${OPM_DATA_ROOT}/norne/ECL.2014.2/NORNE_ATW2013.INIT PORO PORV PERMX )
|
||||
endif()
|
||||
|
||||
include (${CMAKE_CURRENT_SOURCE_DIR}/compareECLFiles.cmake)
|
||||
|
||||
|
||||
endif()
|
||||
|
39
compareECLFiles.cmake
Normal file
39
compareECLFiles.cmake
Normal file
@ -0,0 +1,39 @@
|
||||
# Set absolute tolerance to be used for testing
|
||||
set(abs_tol 2e-2)
|
||||
set(rel_tol 1e-5)
|
||||
# Define some paths
|
||||
set(RESULT_PATH ${PROJECT_BINARY_DIR}/tests/results)
|
||||
# Create directory to store upscaling results in
|
||||
|
||||
###########################################################################
|
||||
# TEST: compareECLFiles
|
||||
###########################################################################
|
||||
|
||||
# Input:
|
||||
# - casename: basename (no extension)
|
||||
#
|
||||
macro (add_test_compareECLFiles casename filename)
|
||||
|
||||
# Add test that runs flow and outputs the results to file
|
||||
opm_add_test(compareECLFiles_${filename} NO_COMPILE
|
||||
EXE_NAME flow
|
||||
DRIVER_ARGS ${OPM_DATA_ROOT}/${casename} ${RESULT_PATH}
|
||||
${CMAKE_BINARY_DIR}/bin
|
||||
${filename}
|
||||
${abs_tol} ${rel_tol}
|
||||
${SUMMARY_REGRESSION_TEST_COMMAND}
|
||||
${RESTART_REGRESSION_TEST_COMMAND}
|
||||
${INIT_REGRESSION_TEST_COMMAND}
|
||||
TEST_ARGS ${OPM_DATA_ROOT}/${casename}/${filename}.DATA )
|
||||
endmacro (add_test_compareECLFiles)
|
||||
|
||||
|
||||
if(NOT TARGET test-suite)
|
||||
add_custom_target(test-suite)
|
||||
endif()
|
||||
|
||||
|
||||
opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-regressionTest.sh "")
|
||||
|
||||
add_test_compareECLFiles(spe9 SPE9_CP)
|
||||
|
29
tests/run-regressionTest.sh
Executable file
29
tests/run-regressionTest.sh
Executable file
@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
INPUT_DATA_PATH="$1"
|
||||
RESULT_PATH="$2"
|
||||
BINPATH="$3"
|
||||
FILENAME="$4"
|
||||
ABS_TOL="$5"
|
||||
REL_TOL="$6"
|
||||
SUMMARY_REGRESSION_TEST_COMMAND="$7"
|
||||
RESTART_REGRESSION_TEST_COMMAND="$8"
|
||||
INIT_REGRESSION_TEST_COMMAND="$9"
|
||||
EXE_NAME="${10}"
|
||||
shift 10
|
||||
TEST_ARGS="$@"
|
||||
|
||||
|
||||
rm -Rf ${RESULT_PATH};
|
||||
mkdir -p ${RESULT_PATH}
|
||||
cd ${RESULT_PATH}
|
||||
${BINPATH}/${EXE_NAME} ${TEST_ARGS}
|
||||
cd ..
|
||||
|
||||
${SUMMARY_REGRESSION_TEST_COMMAND} ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
|
||||
${RESTART_REGRESSION_TEST_COMMAND} ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
|
||||
${INIT_REGRESSION_TEST_COMMAND} ${RESULT_PATH}/${FILENAME} ${INPUT_DATA_PATH}/opm-simulation-reference/${FILENAME} ${ABS_TOL} ${REL_TOL}
|
||||
|
Loading…
Reference in New Issue
Block a user