Skip to content

Commit a7219b3

Browse files
sbryngelsonclaude
andcommitted
Add --shard and failed_uuids.txt support to test toolchain
The CI test scripts use --shard for splitting Frontier GPU tests across multiple jobs, and failed_uuids.txt for retry logic. These toolchain changes were missing from the cherry-pick. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent c37c57f commit a7219b3

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

toolchain/mfc/cli/commands.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,12 @@
452452
default=False,
453453
dest="dry_run",
454454
),
455+
Argument(
456+
name="shard",
457+
help="Run only a subset of tests (e.g., '1/2' for first half, '2/2' for second half).",
458+
type=str,
459+
default=None,
460+
),
455461
],
456462
mutually_exclusive=[
457463
MutuallyExclusiveGroup(arguments=[

toolchain/mfc/test/test.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,14 @@ def __filter(cases_) -> typing.List[TestCase]:
9999
skipped_cases += example_cases
100100
cases = [case for case in cases if case not in example_cases]
101101

102+
if ARG("shard") is not None:
103+
parts = ARG("shard").split("/")
104+
if len(parts) != 2 or not all(p.isdigit() for p in parts) or int(parts[1]) < 1 or not 1 <= int(parts[0]) <= int(parts[1]):
105+
raise MFCException(f"Invalid --shard '{ARG('shard')}': expected 'i/n' with 1 <= i <= n (e.g., '1/2').")
106+
shard_idx, shard_count = int(parts[0]), int(parts[1])
107+
skipped_cases += [c for i, c in enumerate(cases) if i % shard_count != shard_idx - 1]
108+
cases = [c for i, c in enumerate(cases) if i % shard_count == shard_idx - 1]
109+
102110
if ARG("percent") == 100:
103111
return cases, skipped_cases
104112

@@ -206,6 +214,15 @@ def test():
206214
# Build the summary report
207215
_print_test_summary(nPASS, nFAIL, nSKIP, minutes, seconds, failed_tests, skipped_cases)
208216

217+
# Write failed UUIDs to file for CI retry logic
218+
failed_uuids_path = os.path.join(common.MFC_TEST_DIR, "failed_uuids.txt")
219+
if failed_tests:
220+
with open(failed_uuids_path, "w") as f:
221+
for test_info in failed_tests:
222+
f.write(test_info['uuid'] + "\n")
223+
elif os.path.exists(failed_uuids_path):
224+
os.remove(failed_uuids_path)
225+
209226
exit(nFAIL)
210227

211228

0 commit comments

Comments
 (0)