Skip to content

Conversation

boomanaiden154
Copy link
Contributor

This is intended to be used in the premerge advisor. This makes it quite
a bit easier to reuse for the future script to upload failure information to
the premerge advisor.

Created using spr 1.3.7
@llvmbot llvmbot added the infrastructure Bugs about LLVM infrastructure label Oct 13, 2025
@llvmbot
Copy link
Member

llvmbot commented Oct 13, 2025

@llvm/pr-subscribers-infrastructure

Author: Aiden Grossman (boomanaiden154)

Changes

This is intended to be used in the premerge advisor. This makes it quite
a bit easier to reuse for the future script to upload failure information to
the premerge advisor.


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

1 Files Affected:

  • (modified) .ci/generate_test_report_lib.py (+25-15)
diff --git a/.ci/generate_test_report_lib.py b/.ci/generate_test_report_lib.py
index 5026c292a7934..2d18932ace135 100644
--- a/.ci/generate_test_report_lib.py
+++ b/.ci/generate_test_report_lib.py
@@ -98,6 +98,23 @@ def _format_ninja_failures(ninja_failures: list[tuple[str, str]]) -> list[str]:
         )
     return output
 
+def get_failures(junit_objects) -> dict[str, list[tuple[str, str]]]:
+    failures = {}
+    for results in junit_objects:
+        for testsuite in results:
+            for test in testsuite:
+                if (
+                    not test.is_passed
+                    and test.result
+                    and isinstance(test.result[0], Failure)
+                ):
+                    if failures.get(testsuite.name) is None:
+                        failures[testsuite.name] = []
+                    failures[testsuite.name].append(
+                        (test.classname + "/" + test.name, test.result[0].text)
+                    )
+    return failures
+
 
 # Set size_limit to limit the byte size of the report. The default is 1MB as this
 # is the most that can be put into an annotation. If the generated report exceeds
@@ -113,7 +130,7 @@ def generate_report(
     size_limit=1024 * 1024,
     list_failures=True,
 ):
-    failures = {}
+    failures = get_failures(junit_objects)
     tests_run = 0
     tests_skipped = 0
     tests_failed = 0
@@ -124,18 +141,6 @@ def generate_report(
             tests_skipped += testsuite.skipped
             tests_failed += testsuite.failures
 
-            for test in testsuite:
-                if (
-                    not test.is_passed
-                    and test.result
-                    and isinstance(test.result[0], Failure)
-                ):
-                    if failures.get(testsuite.name) is None:
-                        failures[testsuite.name] = []
-                    failures[testsuite.name].append(
-                        (test.classname + "/" + test.name, test.result[0].text)
-                    )
-
     report = [f"# {title}", ""]
 
     if tests_run == 0:
@@ -258,7 +263,7 @@ def plural(num_tests):
     return report
 
 
-def generate_report_from_files(title, return_code, build_log_files):
+def load_info_from_files(build_log_files):
     junit_files = [
         junit_file for junit_file in build_log_files if junit_file.endswith(".xml")
     ]
@@ -271,6 +276,11 @@ def generate_report_from_files(title, return_code, build_log_files):
             ninja_logs.append(
                 [log_line.strip() for log_line in ninja_log_file_handle.readlines()]
             )
+    return [JUnitXml.fromfile(p) for p in junit_files], ninja_logs
+
+
+def generate_report_from_files(title, return_code, build_log_files):
+    junit_objects, ninja_logs = load_info_from_files(build_log_files)
     return generate_report(
-        title, return_code, [JUnitXml.fromfile(p) for p in junit_files], ninja_logs
+        title, return_code, junit_objects, ninja_logs
     )

Copy link

github-actions bot commented Oct 13, 2025

✅ With the latest revision this PR passed the Python code formatter.

Created using spr 1.3.7
boomanaiden154 added a commit to boomanaiden154/llvm-project that referenced this pull request Oct 13, 2025
This is intended to be used in the premerge advisor. This makes it quite
a bit easier to reuse for the future script to upload failure information to
the premerge advisor.

Pull Request: llvm#163275
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

@boomanaiden154 boomanaiden154 merged commit 20bcf12 into main Oct 14, 2025
11 checks passed
@boomanaiden154 boomanaiden154 deleted the users/boomanaiden154/ci-refactor-generate_test_report_lib-to-expose-more-functionality branch October 14, 2025 20:09
llvm-sync bot pushed a commit to arm/arm-toolchain that referenced this pull request Oct 14, 2025
…tionality

This is intended to be used in the premerge advisor. This makes it quite
a bit easier to reuse for the future script to upload failure information to
the premerge advisor.

Reviewers: DavidSpickett, cmtice

Reviewed By: DavidSpickett, cmtice

Pull Request: llvm/llvm-project#163275
akadutta pushed a commit to akadutta/llvm-project that referenced this pull request Oct 14, 2025
This is intended to be used in the premerge advisor. This makes it quite
a bit easier to reuse for the future script to upload failure information to
the premerge advisor.

Reviewers: DavidSpickett, cmtice

Reviewed By: DavidSpickett, cmtice

Pull Request: llvm#163275
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.

4 participants