mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Merge pull request #3477 from akva2/add_update_data_custom_target
added: 'update_data' custom target
This commit is contained in:
commit
95f3f1d5c4
@ -1152,3 +1152,10 @@ endif()
|
|||||||
DIR udq_actionx
|
DIR udq_actionx
|
||||||
TEST_ARGS --linear-solver-reduction=1e-7 --tolerance-cnv=5e-6 --tolerance-mb=1e-6)
|
TEST_ARGS --linear-solver-reduction=1e-7 --tolerance-cnv=5e-6 --tolerance-mb=1e-6)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(OPM_TESTS_ROOT)
|
||||||
|
add_custom_target(update_data
|
||||||
|
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target check --parallel || exit 0
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E env "REASON=Local\ data\ update" ${PROJECT_SOURCE_DIR}/tests/update_reference_data.sh ${OPM_TESTS_ROOT} ${PROJECT_BINARY_DIR}
|
||||||
|
COMMENT "Updating reference data")
|
||||||
|
endif()
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
OPM_TESTS_ROOT=$1
|
OPM_TESTS_ROOT=$1
|
||||||
|
BUILD_DIR=$2
|
||||||
|
CONVERT_ECL=$3
|
||||||
|
|
||||||
TMPDIR=`mktemp -d`
|
TMPDIR=`mktemp -d`
|
||||||
mkdir $TMPDIR/orig
|
mkdir $TMPDIR/orig
|
||||||
mkdir $TMPDIR/new
|
mkdir $TMPDIR/new
|
||||||
@ -22,21 +25,21 @@ copyToReferenceDir () {
|
|||||||
do
|
do
|
||||||
# Don't flag as changed if both reference and result dir lack a file type
|
# Don't flag as changed if both reference and result dir lack a file type
|
||||||
# In particular to handle the optional RFT's
|
# In particular to handle the optional RFT's
|
||||||
if [ ! -f $WORKSPACE/$SRC_DIR$STEM.$filetype ] && [ ! -f $DST_DIR/$STEM.$filetype ]
|
if [ ! -f $SRC_DIR/$STEM.$filetype ] && [ ! -f $DST_DIR/$STEM.$filetype ]
|
||||||
then
|
then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
diff -q "$WORKSPACE/$SRC_DIR$STEM.$filetype" "$DST_DIR/$STEM.$filetype"
|
diff -q "$SRC_DIR/$STEM.$filetype" "$DST_DIR/$STEM.$filetype"
|
||||||
if test $? -ne 0
|
if test $? -ne 0 && test -n "$CONVERT_ECL"
|
||||||
then
|
then
|
||||||
cp $WORKSPACE/$SRC_DIR$STEM.$filetype $TMPDIR/new
|
cp $SRC_DIR/$STEM.$filetype $TMPDIR/new
|
||||||
$configuration/install/bin/convertECL $TMPDIR/new/$STEM.$filetype
|
$CONVERT_ECL $TMPDIR/new/$STEM.$filetype
|
||||||
cp $DST_DIR/$STEM.$filetype $TMPDIR/orig
|
cp $DST_DIR/$STEM.$filetype $TMPDIR/orig
|
||||||
$configuration/install/bin/convertECL $TMPDIR/orig/$STEM.$filetype
|
$CONVERT_ECL $TMPDIR/orig/$STEM.$filetype
|
||||||
diff -u $TMPDIR/orig/$STEM.F$filetype $TMPDIR/new/$STEM.F$filetype >> $WORKSPACE/data_diff
|
diff -u $TMPDIR/orig/$STEM.F$filetype $TMPDIR/new/$STEM.F$filetype >> $WORKSPACE/data_diff
|
||||||
cp "$WORKSPACE/$SRC_DIR$STEM.$filetype" $DST_DIR
|
|
||||||
DIFF=0
|
|
||||||
fi
|
fi
|
||||||
|
cp "$SRC_DIR/$STEM.$filetype" $DST_DIR
|
||||||
|
DIFF=0
|
||||||
done
|
done
|
||||||
|
|
||||||
return $DIFF
|
return $DIFF
|
||||||
@ -156,7 +159,7 @@ tests[co2store_drsdtcon]="flow co2store CO2STORE_DRSDTCON"
|
|||||||
changed_tests=""
|
changed_tests=""
|
||||||
|
|
||||||
# Read failed tests
|
# Read failed tests
|
||||||
FAILED_TESTS=`cat $WORKSPACE/$configuration/build-opm-simulators/Testing/Temporary/LastTestsFailed*.log`
|
FAILED_TESTS=`cat $BUILD_DIR/Testing/Temporary/LastTestsFailed*.log`
|
||||||
|
|
||||||
test -z "$FAILED_TESTS" && exit 5
|
test -z "$FAILED_TESTS" && exit 5
|
||||||
|
|
||||||
@ -171,7 +174,7 @@ do
|
|||||||
if grep -q "$failed" <<< "$binary+$casename"
|
if grep -q "$failed" <<< "$binary+$casename"
|
||||||
then
|
then
|
||||||
copyToReferenceDir \
|
copyToReferenceDir \
|
||||||
$configuration/build-opm-simulators/tests/results/$binary+$test_name/ \
|
$BUILD_DIR/tests/results/$binary+$test_name \
|
||||||
$OPM_TESTS_ROOT/$dirname/opm-simulation-reference/$binary \
|
$OPM_TESTS_ROOT/$dirname/opm-simulation-reference/$binary \
|
||||||
$casename \
|
$casename \
|
||||||
EGRID INIT RFT SMSPEC UNRST UNSMRY
|
EGRID INIT RFT SMSPEC UNRST UNSMRY
|
||||||
@ -182,20 +185,22 @@ done
|
|||||||
|
|
||||||
# special tests
|
# special tests
|
||||||
copyToReferenceDir \
|
copyToReferenceDir \
|
||||||
$configuration/build-opm-simulators/tests/results/init/flow+norne/ \
|
$BUILD_DIR/tests/results/init/flow+norne \
|
||||||
$OPM_TESTS_ROOT/norne/opm-simulation-reference/flow \
|
$OPM_TESTS_ROOT/norne/opm-simulation-reference/flow \
|
||||||
NORNE_ATW2013 \
|
NORNE_ATW2013 \
|
||||||
EGRID INIT
|
EGRID INIT
|
||||||
test $? -eq 0 && changed_tests="$changed_tests norne_init"
|
test $? -eq 0 && changed_tests="$changed_tests norne_init"
|
||||||
|
|
||||||
changed_tests=`echo $changed_tests | xargs`
|
changed_tests=`echo $changed_tests | xargs`
|
||||||
echo -e "Automatic Reference Data Update for PR ${REASON:-(Unknown)}\n" > /tmp/cmsg
|
echo -e "Automatic Reference Data Update for ${REASON:-(Unknown)}\n" > /tmp/cmsg
|
||||||
if [ -z "$REASON" ]
|
if [ -z "$REASON" ]
|
||||||
then
|
then
|
||||||
echo -e "Reason: fill in this\n" >> /tmp/cmsg
|
echo -e "Reason: fill in this\n" >> /tmp/cmsg
|
||||||
else
|
else
|
||||||
echo -e "Reason: $REASON\n" >> /tmp/cmsg
|
echo -e "Reason: $REASON\n" >> /tmp/cmsg
|
||||||
fi
|
fi
|
||||||
|
if [ -n "$CONVERT_ECL" ]
|
||||||
|
then
|
||||||
for dep in opm-common opm-grid opm-material opm-models
|
for dep in opm-common opm-grid opm-material opm-models
|
||||||
do
|
do
|
||||||
pushd $WORKSPACE/deps/$dep > /dev/null
|
pushd $WORKSPACE/deps/$dep > /dev/null
|
||||||
@ -205,6 +210,7 @@ do
|
|||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
done
|
done
|
||||||
echo -e "opm-simulators = `git rev-parse HEAD`" >> /tmp/cmsg
|
echo -e "opm-simulators = `git rev-parse HEAD`" >> /tmp/cmsg
|
||||||
|
fi
|
||||||
|
|
||||||
echo -e "\n### Changed Tests ###\n" >> /tmp/cmsg
|
echo -e "\n### Changed Tests ###\n" >> /tmp/cmsg
|
||||||
for t in ${changed_tests}
|
for t in ${changed_tests}
|
||||||
|
Loading…
Reference in New Issue
Block a user