Add tests that compare runs using the ACTIONX keyword to those that use the PYACTION keyword

This commit is contained in:
Lisa Julia Nebel 2024-04-02 16:16:19 +02:00
parent 6f7cc94da2
commit fb985298b2
2 changed files with 101 additions and 1 deletions

View File

@ -95,6 +95,38 @@ function(add_test_compareECLFiles)
TESTNAME ${PARAM_CASENAME})
endfunction()
function(add_test_compareSeparateECLFiles)
set(oneValueArgs CASENAME FILENAME1 FILENAME2 DIR1 DIR2 SIMULATOR ABS_TOL REL_TOL IGNORE_EXTRA_KW DIR_PREFIX)
set(multiValueArgs TEST_ARGS)
cmake_parse_arguments(PARAM "$" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
if(NOT PARAM_PREFIX)
set(PARAM_PREFIX compareSeparateECLFiles)
endif()
set(RESULT_PATH ${BASE_RESULT_PATH}${PARAM_DIR_PREFIX}/${PARAM_SIMULATOR}+${PARAM_CASENAME})
set(TEST_ARGS ${PARAM_TEST_ARGS})
set(DRIVER_ARGS -i ${OPM_TESTS_ROOT}/${PARAM_DIR1}
-j ${OPM_TESTS_ROOT}/${PARAM_DIR2}
-f ${PARAM_FILENAME1}
-g ${PARAM_FILENAME2}
-r ${RESULT_PATH}
-b ${PROJECT_BINARY_DIR}/bin
-a ${PARAM_ABS_TOL}
-t ${PARAM_REL_TOL}
-c ${COMPARE_ECL_COMMAND})
if(PARAM_IGNORE_EXTRA_KW)
list(APPEND DRIVER_ARGS -y ${PARAM_IGNORE_EXTRA_KW})
endif()
opm_add_test(${PARAM_PREFIX}_${PARAM_SIMULATOR}+${PARAM_CASENAME} NO_COMPILE
EXE_NAME ${PARAM_SIMULATOR}
DRIVER_ARGS ${DRIVER_ARGS}
TEST_ARGS ${TEST_ARGS})
set_tests_properties(${PARAM_PREFIX}_${PARAM_SIMULATOR}+${PARAM_CASENAME} PROPERTIES
DIRNAME ${PARAM_DIR}
FILENAME ${PARAM_FILENAME}
SIMULATOR ${PARAM_SIMULATOR}
TESTNAME ${PARAM_CASENAME})
endfunction()
###########################################################################
# TEST: add_test_compare_restarted_simulation
###########################################################################
@ -361,7 +393,9 @@ add_test_runSimulator(CASENAME tuning_tsinit_nextstep
TEST_ARGS --enable-tuning=true
POST_COMMAND $<TARGET_FILE:test_tuning_tsinit_nextstep>)
if (opm-common_EMBEDDED_PYTHON)
include (${CMAKE_CURRENT_SOURCE_DIR}/pyactionComparisons.cmake)
endif ()
include (${CMAKE_CURRENT_SOURCE_DIR}/regressionTests.cmake)
include (${CMAKE_CURRENT_SOURCE_DIR}/restartTests.cmake)

66
pyactionComparisons.cmake Normal file
View File

@ -0,0 +1,66 @@
# Regression tests
opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-comparison.sh "")
# Set absolute tolerance to be used passed to the macros in the following tests
set(abs_tol 1e+5)
set(rel_tol 2e-5)
set(coarse_rel_tol 1e-2)
add_test_compareSeparateECLFiles(CASENAME pyaction_gconprod_insert_kw
DIR1 pyaction
FILENAME1 PYACTION_GCONPROD_INSERT_KW
DIR2 actionx
FILENAME2 ACTIONX_GCONPROD
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
IGNORE_EXTRA_KW BOTH)
add_test_compareSeparateECLFiles(CASENAME pyaction_mult+_insert_kw
DIR1 pyaction
FILENAME1 PYACTION_MULT+_INSERT_KW
DIR2 actionx
FILENAME2 ACTIONX_MULT+
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
IGNORE_EXTRA_KW BOTH)
add_test_compareSeparateECLFiles(CASENAME pyaction_multx+_insert_kw
DIR1 pyaction
FILENAME1 PYACTION_MULTX+_INSERT_KW
DIR2 actionx
FILENAME2 ACTIONX_MULTX+
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
IGNORE_EXTRA_KW BOTH)
add_test_compareSeparateECLFiles(CASENAME pyaction_multx-_insert_kw
DIR1 pyaction
FILENAME1 PYACTION_MULTX-_INSERT_KW
DIR2 actionx
FILENAME2 ACTIONX_MULTX-
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
IGNORE_EXTRA_KW BOTH)
add_test_compareSeparateECLFiles(CASENAME pyaction_wconprod_insert_kw
DIR1 pyaction
FILENAME1 PYACTION_WCONPROD_INSERT_KW
DIR2 actionx
FILENAME2 ACTIONX_WCONPROD
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
IGNORE_EXTRA_KW BOTH)
add_test_compareSeparateECLFiles(CASENAME pyaction_wefac_insert_kw
DIR1 pyaction
FILENAME1 PYACTION_WEFAC_INSERT_KW
DIR2 actionx
FILENAME2 ACTIONX_WEFAC
SIMULATOR flow
ABS_TOL ${abs_tol}
REL_TOL ${rel_tol}
IGNORE_EXTRA_KW BOTH)