From 01f23ad153f1e44c3c32e1e8f6088a73f3ba3e67 Mon Sep 17 00:00:00 2001 From: Matteo Date: Tue, 7 Jan 2025 16:40:39 +0100 Subject: [PATCH 1/7] feat: add automatic postprocessing of integratedTestsLogs. --- scripts/ci_build_and_test_in_container.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 23bff96bfa3..96370d73063 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -304,8 +304,7 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then echo "Running integrated tests..." integratedTests/geos_ats.sh --baselineCacheDirectory /tmp/geos/baselines - tar -czf ${DATA_EXCHANGE_DIR}/test_logs_${DATA_BASENAME_WE}.tar.gz integratedTests/TestResults - + echo "Checking results..." bin/geos_ats_log_check integratedTests/TestResults/test_results.ini -y ${GEOS_SRC_DIR}/.integrated_tests.yaml &> $tempdir/log_check.txt cat $tempdir/log_check.txt @@ -316,6 +315,10 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then else echo "IntegratedTests failed. Rebaseline is required." + # process integratedTests failures + echo "Processing logs..." + python3 ../scripts/processIntegratedTestCheckFailures --directory integratedTests/TestResults &> integratedTests/TestResults/processedTestsLogs.txt + # Rebaseline and pack into an archive echo "Rebaselining..." integratedTests/geos_ats.sh -a rebaselinefailed @@ -325,6 +328,9 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then INTEGRATED_TEST_EXIT_STATUS=1 fi + echo "Packing logs..." + tar -czf ${DATA_EXCHANGE_DIR}/test_logs_${DATA_BASENAME_WE}.tar.gz integratedTests/TestResults + echo "Done!" # INTEGRATED_TEST_EXIT_STATUS=$? From 52c8c49d9cb7221b3b9b936b2cb20e8e6c9e426d Mon Sep 17 00:00:00 2001 From: Matteo Date: Wed, 8 Jan 2025 11:51:13 +0100 Subject: [PATCH 2/7] change pythonPackages branch. --- scripts/ci_build_and_test_in_container.sh | 2 +- scripts/pygeosx_preprocess.py | 1 - scripts/setupPythonEnvironment.bash | 1 + src/CMakeLists.txt | 4 ++-- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index 96370d73063..c3d91f77cb8 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -317,7 +317,7 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then # process integratedTests failures echo "Processing logs..." - python3 ../scripts/processIntegratedTestCheckFailures --directory integratedTests/TestResults &> integratedTests/TestResults/processedTestsLogs.txt + bin/geos_ats_process_tests_fails --directory integratedTests/TestResults &> integratedTests/TestResults/processedTestsLogs.txt # Rebaseline and pack into an archive echo "Rebaselining..." diff --git a/scripts/pygeosx_preprocess.py b/scripts/pygeosx_preprocess.py index 66c326854e1..9bdd2d9055a 100644 --- a/scripts/pygeosx_preprocess.py +++ b/scripts/pygeosx_preprocess.py @@ -21,6 +21,5 @@ def run_problem(): while pygeosx.run() != pygeosx.COMPLETED: pass - if __name__ == '__main__': run_problem() diff --git a/scripts/setupPythonEnvironment.bash b/scripts/setupPythonEnvironment.bash index 9e7babb894a..338e7013a03 100755 --- a/scripts/setupPythonEnvironment.bash +++ b/scripts/setupPythonEnvironment.bash @@ -24,6 +24,7 @@ declare -a LINK_SCRIPTS=("preprocess_xml" "geos_ats_log_check" "geos_ats_restart_check" "geos_ats_curve_check" + "geos_ats_process_tests_fails" "mesh-doctor" "activate" "python") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09988abe2fd..f82e9b70c2d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -219,8 +219,8 @@ install( FILES ${CMAKE_BINARY_DIR}/schema.xsd ################################ # Add python environment setup ################################ -# message(WARNING "Temporarily changing the geosPythonBranch to bugfix/sherman/fixNumpyProd") -# set(GEOS_PYTHON_PACKAGES_BRANCH "bugfix/sherman/fixNumpyProd" CACHE STRING "" FORCE) +message(WARNING "Temporarily changing the geosPythonBranch to cusini/addFailedTestsLogProcessing") +set(GEOS_PYTHON_PACKAGES_BRANCH "cusini/addFailedTestsLogProcessing" CACHE STRING "" FORCE) if ( Python3_EXECUTABLE ) From 8b4b044d072b679063c68dfb8f85c5d17bb69429 Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 10 Jan 2025 13:16:21 -0800 Subject: [PATCH 3/7] TEST: add new wrapper. --- .../physicsSolvers/fluidFlow/FlowSolverBase.cpp | 6 ++++++ .../physicsSolvers/fluidFlow/FlowSolverBase.hpp | 3 +++ 2 files changed, 9 insertions(+) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index c081f20d4ce..d4485812b90 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -124,6 +124,12 @@ FlowSolverBase::FlowSolverBase( string const & name, setApplyDefaultValue( 0.1 ). setDescription( "Maximum (absolute) temperature change in a sequential iteration, used for outer loop convergence check" ); + this->registerWrapper( "testingTheLogs", m_testLog ). + setSizedFromParent( 0 ). + setApplyDefaultValue( "Testing" ). + setInputFlag( InputFlags::OPTIONAL ). + setDescription( "Testing logs parsing and diff filtering." ); + // allow the user to select a norm getNonlinearSolverParameters().getWrapper< physicsSolverBaseKernels::NormType >( NonlinearSolverParameters::viewKeysStruct::normTypeString() ).setInputFlag( InputFlags::OPTIONAL ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp index 4352e059405..81c011ffa12 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp @@ -254,6 +254,9 @@ class FlowSolverBase : public PhysicsSolverBase real64 m_sequentialTempChange; real64 m_maxSequentialTempChange; + // MATTEO: testing logs parsing + string m_testLog; + /** * @brief Class used for displaying boundary warning message */ From 1506ca6400a3b2e7b374642831e75946158c9dec Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 10 Jan 2025 15:18:51 -0800 Subject: [PATCH 4/7] fix compilation error. --- src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index d4485812b90..e39e4f80fcd 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -124,7 +124,7 @@ FlowSolverBase::FlowSolverBase( string const & name, setApplyDefaultValue( 0.1 ). setDescription( "Maximum (absolute) temperature change in a sequential iteration, used for outer loop convergence check" ); - this->registerWrapper( "testingTheLogs", m_testLog ). + this->registerWrapper( "testingTheLogs", &m_testLog ). setSizedFromParent( 0 ). setApplyDefaultValue( "Testing" ). setInputFlag( InputFlags::OPTIONAL ). From cd4f9238009c41bf4cf674edfe67c6949fec888a Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Fri, 10 Jan 2025 16:18:20 -0800 Subject: [PATCH 5/7] Move the location of the script back. --- scripts/ci_build_and_test_in_container.sh | 11 +-- scripts/processIntegratedTestCheckFailures.py | 94 ------------------- 2 files changed, 4 insertions(+), 101 deletions(-) delete mode 100644 scripts/processIntegratedTestCheckFailures.py diff --git a/scripts/ci_build_and_test_in_container.sh b/scripts/ci_build_and_test_in_container.sh index c3d91f77cb8..6e6ed6e1609 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -304,6 +304,10 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then echo "Running integrated tests..." integratedTests/geos_ats.sh --baselineCacheDirectory /tmp/geos/baselines + echo "Processing logs..." + bin/geos_ats_process_tests_fails --directory integratedTests/TestResults &> integratedTests/TestResults/processedTestsLogs.txt + echo "Packing logs..." + tar -czf ${DATA_EXCHANGE_DIR}/test_logs_${DATA_BASENAME_WE}.tar.gz integratedTests/TestResults echo "Checking results..." bin/geos_ats_log_check integratedTests/TestResults/test_results.ini -y ${GEOS_SRC_DIR}/.integrated_tests.yaml &> $tempdir/log_check.txt @@ -314,10 +318,6 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then INTEGRATED_TEST_EXIT_STATUS=0 else echo "IntegratedTests failed. Rebaseline is required." - - # process integratedTests failures - echo "Processing logs..." - bin/geos_ats_process_tests_fails --directory integratedTests/TestResults &> integratedTests/TestResults/processedTestsLogs.txt # Rebaseline and pack into an archive echo "Rebaselining..." @@ -328,9 +328,6 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then INTEGRATED_TEST_EXIT_STATUS=1 fi - echo "Packing logs..." - tar -czf ${DATA_EXCHANGE_DIR}/test_logs_${DATA_BASENAME_WE}.tar.gz integratedTests/TestResults - echo "Done!" # INTEGRATED_TEST_EXIT_STATUS=$? diff --git a/scripts/processIntegratedTestCheckFailures.py b/scripts/processIntegratedTestCheckFailures.py deleted file mode 100644 index db503687f42..00000000000 --- a/scripts/processIntegratedTestCheckFailures.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python3 -# Python script to -import sys -import os -import stat -import subprocess -import argparse -import platform -import shutil - - -# fines all files recursively from -def findFiles(folder, extension): - for root, folders, files in os.walk(folder): - for filename in folders + files: - if (extension in filename): - yield os.path.join(root, filename) - - -parser = argparse.ArgumentParser(description='Process ats output to filter diffs.') - -parser.add_argument('-d', - '--directory', - type=str, - default='integratedTests', - help='directory to search recursively for files with specified extension') - -parser.add_argument('-ext', '--extension', type=str, default='.log', help='extension of files to filter') - -parser.add_argument('-tl', - '--numTrailingLines', - type=int, - default=5, - help='number of lines to include in block after match is found.') - -parser.add_argument('-e', - '--exclusionStrings', - type=str, - nargs="*", - default=[], - help='What stings to look for in order to exclude a block') - -args, unknown_args = parser.parse_known_args() -if unknown_args: - print("unknown arguments %s" % unknown_args) - -# What strings to look for in order to flag a line/block for output -matchStrings = ['Error:'] - -# What stings to look for in order to exclude a block -print( args.exclusionStrings ) -exclusionStrings = [] -#exclusionStrings = [ 'sizedFromParent', 'different shapes' ] -#exclusionStrings = [ 'but not the' ] -#exclusionStrings = ['logLevel', 'NonlinearSolverParameters', 'has a child', 'different shapes', 'different types', 'differing types'] -exclusionStrings += args.exclusionStrings - -directory = args.directory -extension = args.extension -numTrailingLines = args.numTrailingLines - -for fileName in findFiles(directory, extension): - - filteredErrors = '' - - with open(fileName) as f: - lines = f.readlines() - - for i in range(0, len(lines)): - line = lines[i] - if all(matchString in line for matchString in matchStrings): - matchBlock = ' ' + lines[i - 1] - matchBlock += ' ' + line - - for j in range(1, numTrailingLines + 1): - if i + j >= len(lines): - matchBlock += ' ***** No closing line. file truncated? Filters may not be properly applied! *****' - break - matchBlock += ' ' + lines[i + j] - - if ('******************************************************************************' - in lines[i + j]): - break - i += j - - if not any(excludeString in matchBlock for excludeString in exclusionStrings): - filteredErrors += matchBlock - - if (len(filteredErrors)): - print("\nFound unfiltered diff in: ", fileName) - print(filteredErrors, flush=True) - -#for i in range(1,1+1): -# print( i ) From e55a3e5bfbb28668a80793ffb35d21a38748f2e3 Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Sat, 11 Jan 2025 08:23:20 -0800 Subject: [PATCH 6/7] revert unwanted changes. --- src/CMakeLists.txt | 4 ++-- .../physicsSolvers/fluidFlow/FlowSolverBase.cpp | 6 ------ .../physicsSolvers/fluidFlow/FlowSolverBase.hpp | 3 --- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f82e9b70c2d..595f1cadf18 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -219,8 +219,8 @@ install( FILES ${CMAKE_BINARY_DIR}/schema.xsd ################################ # Add python environment setup ################################ -message(WARNING "Temporarily changing the geosPythonBranch to cusini/addFailedTestsLogProcessing") -set(GEOS_PYTHON_PACKAGES_BRANCH "cusini/addFailedTestsLogProcessing" CACHE STRING "" FORCE) +# message(WARNING "Temporarily changing the geosPythonBranch to cusini/addFailedTestsLogProcessing") +# set(GEOS_PYTHON_PACKAGES_BRANCH "cusini/addFailedTestsLogProcessing" CACHE STRING "" FORCE) if ( Python3_EXECUTABLE ) diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp index e39e4f80fcd..c081f20d4ce 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.cpp @@ -124,12 +124,6 @@ FlowSolverBase::FlowSolverBase( string const & name, setApplyDefaultValue( 0.1 ). setDescription( "Maximum (absolute) temperature change in a sequential iteration, used for outer loop convergence check" ); - this->registerWrapper( "testingTheLogs", &m_testLog ). - setSizedFromParent( 0 ). - setApplyDefaultValue( "Testing" ). - setInputFlag( InputFlags::OPTIONAL ). - setDescription( "Testing logs parsing and diff filtering." ); - // allow the user to select a norm getNonlinearSolverParameters().getWrapper< physicsSolverBaseKernels::NormType >( NonlinearSolverParameters::viewKeysStruct::normTypeString() ).setInputFlag( InputFlags::OPTIONAL ); } diff --git a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp index 81c011ffa12..4352e059405 100644 --- a/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp +++ b/src/coreComponents/physicsSolvers/fluidFlow/FlowSolverBase.hpp @@ -254,9 +254,6 @@ class FlowSolverBase : public PhysicsSolverBase real64 m_sequentialTempChange; real64 m_maxSequentialTempChange; - // MATTEO: testing logs parsing - string m_testLog; - /** * @brief Class used for displaying boundary warning message */ From 8178c36f9dcc8fd7b6d11ed89d7a5aaa2f5367cc Mon Sep 17 00:00:00 2001 From: Matteo Cusini Date: Sat, 11 Jan 2025 08:58:39 -0800 Subject: [PATCH 7/7] revert change. --- scripts/pygeosx_preprocess.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/pygeosx_preprocess.py b/scripts/pygeosx_preprocess.py index 9bdd2d9055a..66c326854e1 100644 --- a/scripts/pygeosx_preprocess.py +++ b/scripts/pygeosx_preprocess.py @@ -21,5 +21,6 @@ def run_problem(): while pygeosx.run() != pygeosx.COMPLETED: pass + if __name__ == '__main__': run_problem()