[llvm] [CI] Add Support for Parsing Ninja Logs to generate_test_report_lib (PR #152620)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 8 06:54:19 PDT 2025
================
@@ -12,6 +12,57 @@
"https://github.com/llvm/llvm-project/issues and add the "
"`infrastructure` label."
)
+# The maximum number of lines to pull from a ninja failure.
+NINJA_LOG_SIZE_THRESHOLD = 500
+
+
+def _parse_ninja_log(ninja_log: list[str]) -> list[tuple[str, str]]:
+ """Parses an individual ninja log."""
+ failures = []
+ index = 0
+ while index < len(ninja_log):
+ while index < len(ninja_log) and not ninja_log[index].startswith("FAILED:"):
+ index += 1
+ if index == len(ninja_log):
+ # We hit the end of the log without finding a build failure, go to
+ # the next log.
+ return failures
+ failing_action = ninja_log[index - 1].split("] ")[1]
+ failure_log = []
+ while (
+ index < len(ninja_log)
+ and not ninja_log[index].startswith("[")
+ and not ninja_log[index].startswith(
+ "ninja: build stopped: subcommand failed"
----------------
boomanaiden154 wrote:
Yeah, not sure. Changing up the grep is easy and likely to cover more cases though.
https://github.com/llvm/llvm-project/pull/152620
More information about the llvm-commits
mailing list