Add gcov-based test pruning with file-level coverage cache#1316
Merged
sbryngelson merged 10 commits intoMFlowCode:masterfrom Mar 17, 2026
Merged
Add gcov-based test pruning with file-level coverage cache#1316sbryngelson merged 10 commits intoMFlowCode:masterfrom
sbryngelson merged 10 commits intoMFlowCode:masterfrom
Conversation
Outdated review (resolved)This review was on an earlier revision. All findings have been addressed. |
c4efbc6 to
68b035b
Compare
Outdated review (resolved)This review was on an earlier revision. All findings have been addressed. |
This comment was marked as resolved.
This comment was marked as resolved.
Contributor
There was a problem hiding this comment.
Pull request overview
Introduces file-level gcov coverage–based test pruning to speed up PR CI runs by running only tests whose covered .fpp files overlap with the PR’s changed files, with CI support to rebuild and distribute the coverage cache when needed.
Changes:
- Adds a coverage cache builder and a
--only-changespruning path to themfc.sh testcommand. - Extends CI to (optionally) rebuild/upload the coverage cache and to run PR tests with
--only-changes. - Updates build/test infrastructure to improve gcov fidelity (Fypp line markers, gcov-friendly flags) and adds offline unit tests for the coverage logic.
Reviewed changes
Copilot reviewed 12 out of 14 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
toolchain/mfc/test/coverage.py |
Implements coverage cache build + changed-file-based pruning logic. |
toolchain/mfc/test/test.py |
Wires --only-changes and --build-coverage-cache into test execution and filtering. |
toolchain/mfc/cli/commands.py |
Adds CLI flags: --build-coverage-cache, --only-changes, --changes-branch. |
toolchain/mfc/test/test_coverage_unit.py |
Adds offline unit tests for the coverage module. |
toolchain/mfc/test/test_coverage_cache.json.gz |
Adds the committed coverage cache artifact. |
toolchain/mfc/test/case.py |
Refactors post_process-related parameter mods for reuse by coverage builder. |
toolchain/mfc/test/cases.py |
Skips 1D_qbmm example due to a gfortran 12 overflow issue. |
CMakeLists.txt |
Adjusts gcov builds (Fypp line markers; disables LTO for gcov; uses -O1 in Release for accuracy/portability). |
.github/workflows/test.yml |
Adds cache rebuild job + artifact download; runs PR tests with --only-changes. |
.github/workflows/common/test.sh |
Enables pruning only on PR events in SLURM-based CI runs. |
.github/workflows/common/rebuild-cache.sh |
Adds SLURM script to rebuild the gcov cache. |
.github/scripts/submit-slurm-job.sh |
Exports GITHUB_EVENT_NAME into SLURM job environment. |
.github/file-filter.yml |
Adds cases_py filter and includes common workflow paths. |
.gitignore |
Ignores legacy raw (non-gz) coverage cache file. |
Comments suppressed due to low confidence (1)
toolchain/mfc/test/test.py:90
- __filter operates on the objects returned by list_cases() (TestCaseBuilder instances), and later test() converts them via
.to_case(). The current return type hint usesList[TestCase], which is misleading and makes type-checking harder; consider changing the annotations toList[TestCaseBuilder](and importing that type) for both inputs and returned lists.
def __filter(cases_) -> typing.Tuple[typing.List[TestCase], typing.List[TestCase]]:
cases = cases_[:]
selected_cases = []
skipped_cases = []
Contributor
Outdated review (resolved)This review was on an earlier revision. All findings have been addressed. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1316 +/- ##
==========================================
- Coverage 45.12% 45.01% -0.11%
==========================================
Files 70 70
Lines 20554 20562 +8
Branches 1962 1962
==========================================
- Hits 9274 9255 -19
- Misses 10152 10179 +27
Partials 1128 1128 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
…rify empty gcno_copies return
…uld_run_all_tests
c6cf6c6 to
f5d7344
Compare
Closed
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
.fppsource files (gzip JSON, committed to repo)--only-changesflag prunes tests by intersecting PR-changed files against coverage cache--build-coverage-cacheflag + 3-phase parallel cache builder (prepare, run, gcov collect)rebuild-cacheCI job runs on Phoenix via SLURM whencases.pyor Fortran dependency graph changesuse/includestatementsALWAYS_RUN_ALLfiles trigger full suiteReplaces #1284.
Test plan
rebuild-cachejob triggers (dep_changed detection)--only-changes🤖 Generated with Claude Code