From 35b6e857c19c0efaedcd7410bc88fde35c14fbbe Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Sat, 31 Oct 2026 18:08:04 +0100 Subject: [PATCH] Make the CI test segfault fallback find the JUnit XML report (#74280) When pytest exits with a segfault, run_ci_tests.sh is meant to check the JUnit XML report and pass the job if every test actually passed. The report path was read from RESULT_LOG_FILE, which nothing sets; under `set -u` the script aborted with "unbound variable" instead, so the fallback never ran and every segfault failed the job with exit code 1. The checker also treated a element without child elements as missing, because an ElementTree element with no children is falsy. Generated-by: Claude Opus 5 --- scripts/in_container/check_junitxml_result.py | 2 +- scripts/in_container/run_ci_tests.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/in_container/check_junitxml_result.py b/scripts/in_container/check_junitxml_result.py index eecb401e698..e35d840a2ac 100755 --- a/scripts/in_container/check_junitxml_result.py +++ b/scripts/in_container/check_junitxml_result.py @@ -30,7 +30,7 @@ if __name__ == "__main__": with open(fname) as fh: root = ET.parse(fh) testsuite = root.find(".//testsuite") - if testsuite: + if testsuite is not None: num_failures = testsuite.get("failures") num_errors = testsuite.get("errors") if num_failures == "0" and num_errors == "0": diff --git a/scripts/in_container/run_ci_tests.sh b/scripts/in_container/run_ci_tests.sh index 77f5e69abb7..d49f49aecc5 100755 --- a/scripts/in_container/run_ci_tests.sh +++ b/scripts/in_container/run_ci_tests.sh @@ -28,6 +28,18 @@ set +e export PYTHONFAULTHANDLER="1" export PYTHONUNBUFFERED="1" +# Breeze passes the JUnit XML path only as a pytest argument. +RESULT_LOG_FILE="" +for arg in "${@}"; do + if [[ ${arg} == --junitxml=* ]]; then + RESULT_LOG_FILE="${arg#--junitxml=}" + fi +done +# A report left by an earlier run would let a segfault pass the check below. +if [[ -n ${RESULT_LOG_FILE} ]]; then + rm -f "${RESULT_LOG_FILE}" +fi + pytest "${@}" RES=$?