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 <testsuite> element without child elements
as missing, because an ElementTree element with no children is falsy.

Generated-by: Claude Opus 5
This commit is contained in:
Jarek Potiuk authored and GitHub committed 2026-10-31 17:08:04 +00:00
1 parent 44e8ff3e44
commit 35b6e857c1
2 files changed
+13 -1

No files matched your search

@@ -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":
+12
View File
@@ -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=$?