|
4 | 4 | Usage: |
5 | 5 | xcresult-cases.py tally [--filters <file>] <input>... |
6 | 6 | verify.sh's notes, then "<executed> <failed> <filters that ran nothing> <runner failures>" |
7 | | - xcresult-cases.py errors <bundle.xcresult> |
8 | | - build errors as "<file>:<line>: <message>" |
| 7 | + xcresult-cases.py errors [--limit <n>] <bundle.xcresult> |
| 8 | + the first n build errors as "<file>:<line>: <message>" |
9 | 9 | xcresult-cases.py summary <input>... |
10 | 10 | the CI step summary; exits 1 when a bundle or a swift test run executed no test, |
11 | 11 | which xcodebuild and swift test both call success |
|
21 | 21 | import urllib.parse |
22 | 22 | import xml.etree.ElementTree as ET |
23 | 23 | from collections import Counter, namedtuple |
| 24 | +from itertools import islice |
24 | 25 | from pathlib import Path |
25 | 26 |
|
26 | 27 | Case = namedtuple("Case", "target suite name label result retried seconds message") |
@@ -252,10 +253,15 @@ def main(arguments): |
252 | 253 | filters, rest = read_filters(rest[1]), rest[2:] |
253 | 254 | print("\n".join(tally([case for argument in rest for case in cases_of(argument)], filters))) |
254 | 255 | return 0 |
255 | | - if command == "errors" and len(rest) == 1: |
256 | | - for where, message in build_errors(xcresulttool(Path(rest[0]), "build-results")): |
257 | | - print(f"{Path(where).name}: {message}" if where else message) |
258 | | - return 0 |
| 256 | + if command == "errors": |
| 257 | + limit = None |
| 258 | + if rest[:1] == ["--limit"] and len(rest) > 1 and rest[1].isdigit(): |
| 259 | + limit, rest = int(rest[1]), rest[2:] |
| 260 | + if len(rest) == 1: |
| 261 | + errors = islice(build_errors(xcresulttool(Path(rest[0]), "build-results")), limit) |
| 262 | + for where, message in errors: |
| 263 | + print(f"{Path(where).name}: {message}" if where else message) |
| 264 | + return 0 |
259 | 265 | if command == "summary": |
260 | 266 | destination = os.environ.get("GITHUB_STEP_SUMMARY") |
261 | 267 | if not destination: |
|
0 commit comments