[llvm] [CI] Parse preceeding lines in mismatched failure messages (PR #170703)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 08:57:20 PST 2025
https://github.com/boomanaiden154 created https://github.com/llvm/llvm-project/pull/170703
In some cases ninja will emit FAILED: lines that are not immediately after a progress indicator. In these cases we also want to capture the preceeding context up to the last progress indicator as it is also part of the error message in the cases that we have seen.
This fixes the rest of #165131.
>From d9325e5ee21127a49da29425e97d33857ce3a4e0 Mon Sep 17 00:00:00 2001
From: Aiden Grossman <aidengrossman at google.com>
Date: Thu, 4 Dec 2025 16:55:39 +0000
Subject: [PATCH] [CI] Parse preceeding lines in mismatched failure messages
In some cases ninja will emit FAILED: lines that are not immediately
after a progress indicator. In these cases we also want to capture the
preceeding context up to the last progress indicator as it is also part
of the error message in the cases that we have seen.
This fixes the rest of #165131.
---
.ci/generate_test_report_lib.py | 12 ++++++++++++
.ci/generate_test_report_lib_test.py | 1 +
2 files changed, 13 insertions(+)
diff --git a/.ci/generate_test_report_lib.py b/.ci/generate_test_report_lib.py
index c62c901fe46f5..9a4fc6030d5ec 100644
--- a/.ci/generate_test_report_lib.py
+++ b/.ci/generate_test_report_lib.py
@@ -62,6 +62,18 @@ def _parse_ninja_log(ninja_log: list[str]) -> list[tuple[str, str]]:
# aligned with the failure.
failing_action = ninja_log[index].split("FAILED: ")[1]
failure_log = []
+
+ # Parse the lines above the FAILED: string if the line does not come
+ # immediately after a progress indicator to ensure that we capture the
+ # entire failure message.
+ if not ninja_log[index - 1].startswith("["):
+ before_index = index - 1
+ while before_index > 0 and not ninja_log[before_index].startswith("["):
+ failure_log.append(ninja_log[before_index])
+ before_index = before_index - 1
+ failure_log.reverse()
+
+ # Parse the failure information, which comes after the FAILED: tag.
while (
index < len(ninja_log)
and not ninja_log[index].startswith("[")
diff --git a/.ci/generate_test_report_lib_test.py b/.ci/generate_test_report_lib_test.py
index 182af1d52641a..b9e992e0f798b 100644
--- a/.ci/generate_test_report_lib_test.py
+++ b/.ci/generate_test_report_lib_test.py
@@ -181,6 +181,7 @@ def test_ninja_log_mismatched_failed(self):
"tools/check-langley",
dedent(
"""\
+ ModuleNotFoundError: No module named 'mount_langley'
FAILED: tools/check-langley
Wow! This system is really broken!"""
),
More information about the llvm-commits
mailing list