[llvm] [CI] Parse preceeding lines in mismatched failure messages (PR #170703)

via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 4 08:57:58 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-infrastructure

Author: Aiden Grossman (boomanaiden154)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/170703.diff


2 Files Affected:

- (modified) .ci/generate_test_report_lib.py (+12) 
- (modified) .ci/generate_test_report_lib_test.py (+1) 


``````````diff
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!"""
                 ),

``````````

</details>


https://github.com/llvm/llvm-project/pull/170703


More information about the llvm-commits mailing list