From f03dd03517171586685c939ae723552be664bf65 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Wed, 12 Nov 2025 11:54:09 +0100 Subject: [PATCH] added: add compareSeparateEclFiles to failure report --- compareECLFiles.cmake | 6 +++++- tests/make_failure_report.sh | 33 ++++++++++++++++++++++----------- tests/plot_well_comparison.py | 8 +++++--- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/compareECLFiles.cmake b/compareECLFiles.cmake index da34fd6f6e..d455be7384 100644 --- a/compareECLFiles.cmake +++ b/compareECLFiles.cmake @@ -118,6 +118,9 @@ function(add_test_compareSeparateECLFiles) else() set(MPI_PROCS 1) endif() + if(NOT PARAM_DIR) + set(PARAM_DIR ${PARAM_CASENAME}) + 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} @@ -139,7 +142,8 @@ function(add_test_compareSeparateECLFiles) TEST_ARGS ${TEST_ARGS}) set_tests_properties(${PARAM_PREFIX}_${PARAM_SIMULATOR}+${PARAM_CASENAME} PROPERTIES DIRNAME ${PARAM_DIR} - FILENAME ${PARAM_FILENAME} + FILENAME1 ${PARAM_FILENAME1} + FILENAME2 ${PARAM_FILENAME2} SIMULATOR ${PARAM_SIMULATOR} TESTNAME ${PARAM_CASENAME} PROCESSORS ${MPI_PROCS}) diff --git a/tests/make_failure_report.sh b/tests/make_failure_report.sh index b835f2c9f9..b30e43892a 100755 --- a/tests/make_failure_report.sh +++ b/tests/make_failure_report.sh @@ -15,17 +15,28 @@ rm -f * for failed_test in $FAILED_TESTS do - grep -q -E "compareECLFiles" <<< $failed_test - test $? -ne 0 && continue - - failed_test=`echo $failed_test | sed -e 's/.*://g' -e 's/\+/./g'` - # Extract test properties - binary=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="SIMULATOR" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake) - 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 + if grep -q -E "compareECLFiles" <<< $failed_test + then + failed_test=`echo $failed_test | sed -e 's/.*://g' -e 's/\+/./g'` + # Extract test properties + binary=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="SIMULATOR" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake) + 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 + elif grep -q -E "compareSeparateECLFiles" <<< $failed_test + then + failed_test=`echo $failed_test | sed -e 's/.*://g' -e 's/\+/./g'` + # Extract test properties + binary=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="SIMULATOR" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake) + dir_name=$(awk -v search="set_tests_properties\\\($failed_test\$" -v prop="DIRNAME" -f ${SOURCE_DIR}/getprop.awk $RESULT_DIR/CTestTestfile.cmake) + 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" + fi done if test -n "$FAILED_TESTS" diff --git a/tests/plot_well_comparison.py b/tests/plot_well_comparison.py index 10ccfb7509..30a2a55b72 100755 --- a/tests/plot_well_comparison.py +++ b/tests/plot_well_comparison.py @@ -17,7 +17,7 @@ from scipy import integrate, stats # Run analysis of a test. # Calculate the deviation for each curve # and generate a pdf with plots ordered according to deviation -def run_analysis(ref_file_name, sys_file_name, test_name): +def run_analysis(ref_file_name, sys_file_name, test_name, ref_name, sim_name): ref_file = ESmry(ref_file_name + '.SMSPEC') sim_file = ESmry(sys_file_name + '.SMSPEC') @@ -68,7 +68,7 @@ def run_analysis(ref_file_name, sys_file_name, test_name): fig, ax = plt.subplots() ax.plot(ref_time, ref, linestyle='dashed', linewidth=0.5, marker='o', markersize=1.0) ax.plot(sim_time, sim, linewidth=0.5, marker='x', markersize=1.0) - ax.legend(['Reference', 'New simulation']) + ax.legend([ref_name, sim_name]) plt.title(r) u = ref_file.units(r) if u: @@ -111,10 +111,12 @@ parser = argparse.ArgumentParser('plot_well_comparison.py') parser.add_argument('-c', help='Name of test to process', dest='test_name') parser.add_argument('-r', help='Reference file', dest='ref_file') parser.add_argument('-s', help='Simulation file', dest='sim_file') +parser.add_argument('-t', help='Name for first simulation', dest='ref_name', default='Reference') +parser.add_argument('-u', help='Name for second simulation', dest='sim_name', default='New simulation') parser.add_argument('-o', choices=['plot', 'rename'], help='Operation to do', required=True, dest='operation') args = parser.parse_args() if args.operation == 'plot': - run_analysis(args.ref_file, args.sim_file, args.test_name) + run_analysis(args.ref_file, args.sim_file, args.test_name, args.ref_name, args.sim_name) else: reorder_files()