Skip to content

Conversation

@boomanaiden154
Copy link
Contributor

@boomanaiden154 boomanaiden154 commented Nov 2, 2025

There are cases where the progress indicator does not align at all with
the action printed in FAILED:. Default to just using the action there so
that we can ensure the results are accurate. This still leaves some
issues where we are not capturing all the log lines, but I'll look at
those in a future crash. Those are also less critical since they do not
cause the script to patch.

Partially fixes #165131.

Created using spr 1.3.7
@llvmbot llvmbot added the infrastructure Bugs about LLVM infrastructure label Nov 2, 2025
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Nov 2, 2025
There are cases where the progress indicator does not align at all with
the action printed in FAILED:. Default to just using the action there so
that we can ensure the results are accurate. This still leaves some
issues where we are not capturing all the log lines, but I'll look at
those in a future crash. Those are also less critical since they do not
cause the script to crash.

Partially fixes llvm#165131.

Pull Request: llvm#166100
@llvmbot
Copy link
Member

llvmbot commented Nov 2, 2025

@llvm/pr-subscribers-infrastructure

Author: Aiden Grossman (boomanaiden154)

Changes

There are cases where the progress indicator does not align at all with
the action printed in FAILED:. Default to just using the action there so
that we can ensure the results are accurate. This still leaves some
issues where we are not capturing all the log lines, but I'll look at
those in a future crash. Those are also less critical since they do not
cause the script to crash.

Partially fixes #165131.


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

2 Files Affected:

  • (modified) .ci/generate_test_report_lib.py (+7-4)
  • (modified) .ci/generate_test_report_lib_test.py (+35-7)
diff --git a/.ci/generate_test_report_lib.py b/.ci/generate_test_report_lib.py
index 36c95852452ac..d5fe437155a83 100644
--- a/.ci/generate_test_report_lib.py
+++ b/.ci/generate_test_report_lib.py
@@ -41,10 +41,13 @@ def _parse_ninja_log(ninja_log: list[str]) -> list[tuple[str, str]]:
         # touch test/4.stamp
         #
         # index will point to the line that starts with Failed:. The progress
-        # indicator is the line before this ([4/5] test/4.stamp) and contains a pretty
-        # printed version of the target being built (test/4.stamp). We use this line
-        # and remove the progress information to get a succinct name for the target.
-        failing_action = ninja_log[index - 1].split("] ")[1]
+        # indicator is sometimes the line before this ([4/5] test/4.stamp) and
+        # will contain a pretty printed version of the target being built
+        # (test/4.stamp) when accurate. We instead parse the failed line rather
+        # than the progress indicator as the progress indicator may not be
+        # aligned with the failure.
+        failing_action = ninja_log[index].split("FAILED: ")[1]
+        print(failing_action)
         failure_log = []
         while (
             index < len(ninja_log)
diff --git a/.ci/generate_test_report_lib_test.py b/.ci/generate_test_report_lib_test.py
index a8659e1d6a3e3..a8991f139e055 100644
--- a/.ci/generate_test_report_lib_test.py
+++ b/.ci/generate_test_report_lib_test.py
@@ -39,7 +39,7 @@ def test_find_failure_ninja_logs(self):
         self.assertEqual(
             failures[0],
             (
-                "test/4.stamp",
+                "touch test/4.stamp",
                 dedent(
                     """\
                     FAILED: touch test/4.stamp
@@ -77,7 +77,7 @@ def test_ninja_log_end(self):
         self.assertEqual(
             failures[0],
             (
-                "test/3.stamp",
+                "touch test/3.stamp",
                 dedent(
                     """\
                     FAILED: touch test/3.stamp
@@ -106,7 +106,7 @@ def test_ninja_log_multiple_failures(self):
         self.assertEqual(
             failures[0],
             (
-                "test/2.stamp",
+                "touch test/2.stamp",
                 dedent(
                     """\
                     FAILED: touch test/2.stamp
@@ -117,7 +117,7 @@ def test_ninja_log_multiple_failures(self):
         self.assertEqual(
             failures[1],
             (
-                "test/4.stamp",
+                "touch test/4.stamp",
                 dedent(
                     """\
                     FAILED: touch test/4.stamp
@@ -150,7 +150,7 @@ def test_ninja_log_runtimes_failure(self):
         self.assertEqual(
             failures[0],
             (
-                "test/2.stamp",
+                "touch test/2.stamp",
                 dedent(
                     """\
                     FAILED: touch test/2.stamp
@@ -159,6 +159,34 @@ def test_ninja_log_runtimes_failure(self):
             ),
         )
 
+    # Test that we correctly handle cases where the FAILED: line does not
+    # match up with the progress indicator.
+    def test_ninja_log_mismatched_failed(self):
+        failures = generate_test_report_lib.find_failure_in_ninja_logs(
+            [
+                [
+                    "[1/5] test/1.stamp",
+                    "[2/5] test/2.stamp",
+                    "ModuleNotFoundError: No module named 'mount_langley'",
+                    "FAILED: tools/check-langley",
+                    "Wow! This system is really broken!",
+                    "[5/5] test/5.stamp",
+                ]
+            ]
+        )
+        self.assertEqual(len(failures), 1)
+        self.assertEqual(
+            failures[0],
+            (
+                "tools/check-langley",
+                dedent(
+                    """\
+                    FAILED: tools/check-langley
+                    Wow! This system is really broken!"""
+                ),
+            ),
+        )
+
     def test_title_only(self):
         self.assertEqual(
             generate_test_report_lib.generate_report("Foo", 0, [], []),
@@ -449,7 +477,7 @@ def test_no_failures_multiple_build_failed_ninja_log(self):
                     All tests passed but another part of the build **failed**. Click on a failure below to see the details.
 
                     <details>
-                    <summary>test/2.stamp</summary>
+                    <summary>touch test/2.stamp</summary>
 
                     ```
                     FAILED: touch test/2.stamp
@@ -457,7 +485,7 @@ def test_no_failures_multiple_build_failed_ninja_log(self):
                     ```
                     </details>
                     <details>
-                    <summary>test/4.stamp</summary>
+                    <summary>touch test/4.stamp</summary>
 
                     ```
                     FAILED: touch test/4.stamp

Created using spr 1.3.7
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Nov 2, 2025
There are cases where the progress indicator does not align at all with
the action printed in FAILED:. Default to just using the action there so
that we can ensure the results are accurate. This still leaves some
issues where we are not capturing all the log lines, but I'll look at
those in a future crash. Those are also less critical since they do not
cause the script to crash.

Partially fixes llvm#165131.

Pull Request: llvm#166100
Copy link
Collaborator

@DavidSpickett DavidSpickett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DavidSpickett
Copy link
Collaborator

those in a future crash

future patch

@boomanaiden154
Copy link
Contributor Author

future patch

Ah, yep. Thanks for pointing that out. Definitely not intending to introduce new crashes in the future!

@boomanaiden154 boomanaiden154 merged commit 5256db3 into main Nov 3, 2025
11 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/ci-use-action-from-failed-in-ninja-log-parser branch November 3, 2025 14:01
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Nov 3, 2025
There are cases where the progress indicator does not align at all with
the action printed in FAILED:. Default to just using the action there so
that we can ensure the results are accurate. This still leaves some
issues where we are not capturing all the log lines, but I'll look at
those in a future crash. Those are also less critical since they do not
cause the script to patch.

Partially fixes #165131.

Reviewers: DavidSpickett

Reviewed By: DavidSpickett

Pull Request: llvm/llvm-project#166100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

infrastructure Bugs about LLVM infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CI] Ninja Log Parser Fails on PR

4 participants