From fd36d2adcb737e6eef6c7dfcdb61b060bd98d7ef Mon Sep 17 00:00:00 2001 From: Matteo Cusini <49037133+CusiniM@users.noreply.github.com> Date: Sun, 12 Jan 2025 10:08:24 -0800 Subject: [PATCH] feat: add automatic postprocessing of integratedTestsLogs. (#3509) --- scripts/ci_build_and_test_in_container.sh | 7 +- scripts/processIntegratedTestCheckFailures.py | 94 ------------------- scripts/setupPythonEnvironment.bash | 1 + src/CMakeLists.txt | 4 +- 4 files changed, 8 insertions(+), 98 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 23bff96bfa3..6e6ed6e1609 100755 --- a/scripts/ci_build_and_test_in_container.sh +++ b/scripts/ci_build_and_test_in_container.sh @@ -304,8 +304,11 @@ 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 cat $tempdir/log_check.txt @@ -315,7 +318,7 @@ if [[ "${RUN_INTEGRATED_TESTS}" = true ]]; then INTEGRATED_TEST_EXIT_STATUS=0 else echo "IntegratedTests failed. Rebaseline is required." - + # Rebaseline and pack into an archive echo "Rebaselining..." integratedTests/geos_ats.sh -a rebaselinefailed 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 ) 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..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 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 )