You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add gcov-based test pruning with file-level coverage cache
Build a coverage cache mapping each test to the source files it exercises,
enabling --only-changes to skip tests unaffected by a PR's changes.
Key components:
- toolchain/mfc/test/coverage.py: cache build (3-phase: prepare, run, collect),
cache load/staleness detection, git diff integration, test filtering
- --build-coverage-cache CLI flag for one-time cache generation
- --only-changes / --changes-branch CLI flags for coverage-based filtering
- CI: rebuild-cache + commit-cache jobs auto-update cache when cases.py changes
- Phoenix CI: use GNR nodes (192 cores) with 64-thread parallel test execution
- 54 unit tests for coverage module
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: toolchain/mfc/cli/commands.py
+25Lines changed: 25 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -458,6 +458,27 @@
458
458
type=str,
459
459
default=None,
460
460
),
461
+
Argument(
462
+
name="build-coverage-cache",
463
+
help="Run all tests sequentially with gcov instrumentation to build the line-level coverage cache. Requires a prior --gcov build: ./mfc.sh build --gcov -j 8",
464
+
action=ArgAction.STORE_TRUE,
465
+
default=False,
466
+
dest="build_coverage_cache",
467
+
),
468
+
Argument(
469
+
name="only-changes",
470
+
help="Only run tests whose covered lines overlap with lines changed since branching from master (uses line-level gcov coverage cache).",
471
+
action=ArgAction.STORE_TRUE,
472
+
default=False,
473
+
dest="only_changes",
474
+
),
475
+
Argument(
476
+
name="changes-branch",
477
+
help="Branch to compare against for --only-changes (default: master).",
478
+
type=str,
479
+
default="master",
480
+
dest="changes_branch",
481
+
),
461
482
],
462
483
mutually_exclusive=[
463
484
MutuallyExclusiveGroup(arguments=[
@@ -488,13 +509,17 @@
488
509
Example("./mfc.sh test -j 4", "Run with 4 parallel jobs"),
489
510
Example("./mfc.sh test --only 3D", "Run only 3D tests"),
490
511
Example("./mfc.sh test --generate", "Regenerate golden files"),
512
+
Example("./mfc.sh test --only-changes -j 4", "Run tests affected by changed lines"),
0 commit comments