From c5d27bf6ed2b67e583f1395e037e2545935eb74a Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 26 Jan 2017 10:52:49 +0100 Subject: [PATCH 1/2] refinement in regression data update script to aid automation --- tests/update_reference_data.sh | 53 ++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 9 deletions(-) diff --git a/tests/update_reference_data.sh b/tests/update_reference_data.sh index 625f2ee9b..f52bff681 100755 --- a/tests/update_reference_data.sh +++ b/tests/update_reference_data.sh @@ -14,11 +14,13 @@ copyToReferenceDir () { FILETYPES=${@:4}; for filetype in $FILETYPES; do - echo cp "$WORKSPACE/$SRC_DIR$STEM.$filetype" $DST_DIR + cp "$WORKSPACE/$SRC_DIR$STEM.$filetype" $DST_DIR 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 then copyToReferenceDir \ @@ -40,7 +42,7 @@ for test_name in ${@:2}; do if grep -q "spe3" <<< $test_name then 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/ \ SPE3CASE1 \ EGRID INIT PRT SMSPEC UNRST UNSMRY @@ -54,14 +56,37 @@ for test_name in ${@:2}; do SPE9_CP_SHORT \ EGRID INIT PRT SMSPEC UNRST UNSMRY 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 +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 ${@:2}\n" > /tmp/cmsg -echo -e "Reason: fill in this\n" >> /tmp/cmsg +echo -e "update reference data for $tests\n" > /tmp/cmsg +if [ -z "$REASON" ] +then + 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 do pushd $WORKSPACE/deps/$dep > /dev/null @@ -73,4 +98,14 @@ done echo -e "opm-simulators = `git rev-parse HEAD`" >> /tmp/cmsg 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 From e12aecc3f52dcbf11531e727c3e22b5e3f335b29 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 26 Jan 2017 12:13:58 +0100 Subject: [PATCH 2/2] bug introduced by macro reuse there was another reason for the dedicated macro - the output directory for the tests. add another macro parameter to handle this --- compareECLFiles.cmake | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/compareECLFiles.cmake b/compareECLFiles.cmake index e72762dce..653d6f7d3 100644 --- a/compareECLFiles.cmake +++ b/compareECLFiles.cmake @@ -20,9 +20,8 @@ set(BASE_RESULT_PATH ${PROJECT_BINARY_DIR}/tests/results) # # Details: # - This test class compares output from a simulation to reference files. -macro (add_test_compareECLFiles casename filename simulator abs_tol rel_tol prefix) - - set(RESULT_PATH ${BASE_RESULT_PATH}/${simulator}+${casename}) +macro (add_test_compareECLFiles casename filename simulator abs_tol rel_tol prefix dirprefix) + set(RESULT_PATH ${BASE_RESULT_PATH}${dirprefix}/${simulator}+${casename}) opm_add_test(${prefix}_${simulator}+${filename} NO_COMPILE EXE_NAME ${simulator} 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(rel_tol 1e-5) -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(spe3 SPE3CASE1 flow ${abs_tol} ${rel_tol} compareECLFiles) -add_test_compareECLFiles(spe9 SPE9_CP_SHORT 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(spe3 SPE3CASE1 flow ${abs_tol} ${rel_tol} compareECLFiles "") +add_test_compareECLFiles(spe9 SPE9_CP_SHORT flow ${abs_tol} ${rel_tol} compareECLFiles "") # Restart tests 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 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 if(MPI_FOUND)