Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tests/make_failure_report.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ OPM_TESTS_ROOT=$1
BUILD_DIR=$2
RESULT_DIR=$3
SOURCE_DIR=`dirname "$0"`
JOBS=${BUILDTHREADS:-16}

FAILED_TESTS=`cat $BUILD_DIR/Testing/Temporary/LastTestsFailed*.log`

mkdir -p $BUILD_DIR/failure_report
cd $BUILD_DIR/failure_report
rm -f *

JOBLIST=""
for failed_test in $FAILED_TESTS
do
if grep -q -E "compareECLFiles" <<< $failed_test
Expand All @@ -23,8 +25,7 @@ do
dir_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="DIRNAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
file_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="FILENAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
test_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="TESTNAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
echo "Processing ${test_name}"
$SOURCE_DIR/plot_well_comparison.py -r $OPM_TESTS_ROOT/$dir_name/opm-simulation-reference/$binary/$file_name -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name -c $test_name -o plot
JOBLIST+="-r $OPM_TESTS_ROOT/$dir_name/opm-simulation-reference/$binary/$file_name -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name -c $test_name -o plot\\n"
elif grep -q -E "compareSeparateECLFiles" <<< $failed_test
then
failed_test=`echo $failed_test | sed -e 's/.*://g' -e 's/\+/./g'`
Expand All @@ -34,11 +35,12 @@ do
file_name1=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="FILENAME1" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
file_name2=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="FILENAME2" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
test_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="TESTNAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake)
echo "Processing ${test_name}"
$SOURCE_DIR/plot_well_comparison.py -r $RESULT_DIR/tests/results/$binary+$test_name/$file_name1 -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name2 -c $test_name -o plot -t "$file_name1" -u "$file_name2"
JOBLIST+="-r $RESULT_DIR/tests/results/$binary+$test_name/$file_name1 -s $RESULT_DIR/tests/results/$binary+$test_name/$file_name2 -c $test_name -o plot -t $file_name1 -u $file_name2\\n"
fi
done

echo -e $JOBLIST | xargs -L1 -P${JOBS} $SOURCE_DIR/plot_well_comparison.py

if test -n "$FAILED_TESTS"
then
$SOURCE_DIR/plot_well_comparison.py -o rename
Expand Down
12 changes: 8 additions & 4 deletions tests/plot_well_comparison.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import argparse
from datetime import datetime, timedelta
from filelock import FileLock
import matplotlib.pyplot as plt
from matplotlib.dates import DateFormatter
from matplotlib.backends.backend_pdf import PdfPages
Expand Down Expand Up @@ -84,16 +85,18 @@ def run_analysis(ref_file_name, sys_file_name, test_name, ref_name, sim_name):
p.close()

if os.path.exists('max_devs.pkl'):
with open('max_devs.pkl', 'rb') as f:
max_deviations = pickle.load(f)
with FileLock('max_devs.lck'):
with open('max_devs.pkl', 'rb') as f:
max_deviations = pickle.load(f)
else:
max_deviations = {}

max_dev = max(deviation, key = lambda x: deviation[x])
max_deviations[test_name] = deviation[max_dev]

with open('max_devs.pkl', 'wb') as f:
pickle.dump(max_deviations, f)
with FileLock('max_devs.lck'):
with open('max_devs.pkl', 'wb') as f:
pickle.dump(max_deviations, f)

# Rename files to rank them according to maximum deviations
def reorder_files():
Expand All @@ -117,6 +120,7 @@ def reorder_files():
args = parser.parse_args()

if args.operation == 'plot':
print(f"Processing {args.test_name}")
run_analysis(args.ref_file, args.sim_file, args.test_name, args.ref_name, args.sim_name)
else:
reorder_files()