Merge pull request #1038 from akva2/test_update_automation

refinement in regression data update script to aid automation
This commit is contained in:
Atgeirr Flø Rasmussen 2017-01-26 13:54:03 +01:00 committed by GitHub
commit 72a83222a1
2 changed files with 51 additions and 17 deletions

View File

@ -20,9 +20,8 @@ set(BASE_RESULT_PATH ${PROJECT_BINARY_DIR}/tests/results)
# #
# Details: # Details:
# - This test class compares output from a simulation to reference files. # - This test class compares output from a simulation to reference files.
macro (add_test_compareECLFiles casename filename simulator abs_tol rel_tol prefix) macro (add_test_compareECLFiles casename filename simulator abs_tol rel_tol prefix dirprefix)
set(RESULT_PATH ${BASE_RESULT_PATH}${dirprefix}/${simulator}+${casename})
set(RESULT_PATH ${BASE_RESULT_PATH}/${simulator}+${casename})
opm_add_test(${prefix}_${simulator}+${filename} NO_COMPILE opm_add_test(${prefix}_${simulator}+${filename} NO_COMPILE
EXE_NAME ${simulator} EXE_NAME ${simulator}
DRIVER_ARGS ${OPM_DATA_ROOT}/${casename} ${RESULT_PATH} DRIVER_ARGS ${OPM_DATA_ROOT}/${casename} ${RESULT_PATH}
@ -94,10 +93,10 @@ opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-regressionTest.sh "")
set(abs_tol 2e-2) set(abs_tol 2e-2)
set(rel_tol 1e-5) set(rel_tol 1e-5)
add_test_compareECLFiles(spe1 SPE1CASE2 flow ${abs_tol} ${rel_tol} compareECLFiles) add_test_compareECLFiles(spe1 SPE1CASE2 flow ${abs_tol} ${rel_tol} compareECLFiles "")
add_test_compareECLFiles(spe1 SPE1CASE1 flow_sequential ${abs_tol} ${rel_tol} compareECLFiles) add_test_compareECLFiles(spe1 SPE1CASE1 flow_sequential ${abs_tol} ${rel_tol} compareECLFiles "")
add_test_compareECLFiles(spe3 SPE3CASE1 flow ${abs_tol} ${rel_tol} compareECLFiles) add_test_compareECLFiles(spe3 SPE3CASE1 flow ${abs_tol} ${rel_tol} compareECLFiles "")
add_test_compareECLFiles(spe9 SPE9_CP_SHORT flow ${abs_tol} ${rel_tol} compareECLFiles) add_test_compareECLFiles(spe9 SPE9_CP_SHORT flow ${abs_tol} ${rel_tol} compareECLFiles "")
# Restart tests # Restart tests
opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-restart-regressionTest.sh "") opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-restart-regressionTest.sh "")
@ -111,7 +110,7 @@ add_test_compare_restarted_simulation(spe9 SPE9_CP_SHORT flow ${abs_tol_restart}
# Init tests # Init tests
opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-init-regressionTest.sh "") opm_set_test_driver(${PROJECT_SOURCE_DIR}/tests/run-init-regressionTest.sh "")
add_test_compareECLFiles(norne NORNE_ATW2013 flow ${abs_tol} ${rel_tol} compareECLInitFiles) add_test_compareECLFiles(norne NORNE_ATW2013 flow ${abs_tol} ${rel_tol} compareECLInitFiles /init)
# Parallel tests # Parallel tests
if(MPI_FOUND) if(MPI_FOUND)

View File

@ -14,11 +14,13 @@ copyToReferenceDir () {
FILETYPES=${@:4}; FILETYPES=${@:4};
for filetype in $FILETYPES; do for filetype in $FILETYPES; do
echo cp "$WORKSPACE/$SRC_DIR$STEM.$filetype" $DST_DIR cp "$WORKSPACE/$SRC_DIR$STEM.$filetype" $DST_DIR
done done
} }
for test_name in ${@:2}; do tests=${@:2}
test -z "$tests" && tests="spe11 spe12 spe3 spe9 norne_init"
for test_name in ${tests}; do
if grep -q "spe11" <<< $test_name if grep -q "spe11" <<< $test_name
then then
copyToReferenceDir \ copyToReferenceDir \
@ -40,7 +42,7 @@ for test_name in ${@:2}; do
if grep -q "spe3" <<< $test_name if grep -q "spe3" <<< $test_name
then then
copyToReferenceDir \ copyToReferenceDir \
$configuration/build-opm-simulators/tests/results/flow_sequential+spe3/ \ $configuration/build-opm-simulators/tests/results/flow+spe3/ \
$OPM_DATA_ROOT/spe3/opm-simulation-reference/ \ $OPM_DATA_ROOT/spe3/opm-simulation-reference/ \
SPE3CASE1 \ SPE3CASE1 \
EGRID INIT PRT SMSPEC UNRST UNSMRY EGRID INIT PRT SMSPEC UNRST UNSMRY
@ -54,14 +56,37 @@ for test_name in ${@:2}; do
SPE9_CP_SHORT \ SPE9_CP_SHORT \
EGRID INIT PRT SMSPEC UNRST UNSMRY EGRID INIT PRT SMSPEC UNRST UNSMRY
fi fi
if grep -q "norne_init" <<< $test_name
then
copyToReferenceDir \
$configuration/build-opm-simulators/tests/results/init/flow+norne/ \
$OPM_DATA_ROOT/norne/opm-simulation-reference/ \
NORNE_ATW2013 \
EGRID INIT
fi
done done
if [ -z "${@:2}" ]
then
# User did not specify tests to update, probe
pushd $OPM_DATA_ROOT > /dev/null
tests=""
git status | grep "SPE1CASE1" && tests="spe11"
git status | grep "SPE1CASE2" && tests="$tests spe12"
git status | grep "SPE3CASE1" && tests="$tests spe3"
git status | grep "SPE9_CP" && tests="$tests spe9"
git status | grep "NORNE_ATW2013" && tests="$tests norne_init"
popd > /dev/null
fi
echo -e "update reference data for $tests\n" > /tmp/cmsg
if [ -z "$REASON" ]
then
echo -e "update reference data for ${@:2}\n" > /tmp/cmsg echo -e "Reason: fill in this\n" >> /tmp/cmsg
echo -e "Reason: fill in this\n" >> /tmp/cmsg else
echo -e "Reason: $REASON\n" >> /tmp/cmsg
fi
for dep in ert opm-common opm-core opm-grid opm-material opm-parser opm-output ewoms for dep in ert opm-common opm-core opm-grid opm-material opm-parser opm-output ewoms
do do
pushd $WORKSPACE/deps/$dep > /dev/null pushd $WORKSPACE/deps/$dep > /dev/null
@ -73,4 +98,14 @@ done
echo -e "opm-simulators = `git rev-parse HEAD`" >> /tmp/cmsg echo -e "opm-simulators = `git rev-parse HEAD`" >> /tmp/cmsg
cd $OPM_DATA_ROOT cd $OPM_DATA_ROOT
git commit -a -t /tmp/cmsg if [ -n "$BRANCH_NAME" ]
then
git checkout -b $BRANCH_NAME origin/master
fi
if [ -z "$REASON" ]
then
git commit -a -t /tmp/cmsg
else
git commit -a -F /tmp/cmsg
fi