Skip to content

Commit 6d068b0

Browse files
committed
fix(test): force full run on src/**/include/ changes (gcov can't attribute includes)
1 parent 81e723f commit 6d068b0

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

toolchain/mfc/test/coverage.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,13 @@ def is_always_run_all(changed_files: set) -> bool:
5252
"""True if any changed file forces the full suite (un-attributable by the CPU map)."""
5353
if changed_files & ALWAYS_RUN_ALL_EXACT:
5454
return True
55-
return any(f.startswith(ALWAYS_RUN_ALL_PREFIXES) for f in changed_files)
55+
if any(f.startswith(ALWAYS_RUN_ALL_PREFIXES) for f in changed_files):
56+
return True
57+
# gcov rolls #:include'd .fpp into the parent compilation unit, so include files
58+
# (inline_*.fpp, HardcodedIC, macros) are not reliably attributed in the map. Force a
59+
# full run for ANY src/**/include/ change so this attribution gap can never cause
60+
# under-inclusion — by rule, not by relying on the file being absent from the map.
61+
return any(f.startswith("src/") and "/include/" in f and f.endswith(".fpp") for f in changed_files)
5662

5763

5864
def load_map(path: Path) -> Tuple[Optional[dict], Optional[dict]]:

toolchain/mfc/test/test_coverage_unit.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,3 +261,9 @@ def test_changed_files_explicit_space_and_comma_separated():
261261

262262
assert get_changed_files("/r", "master", explicit="src/a.fpp src/b.fpp") == {"src/a.fpp", "src/b.fpp"}
263263
assert get_changed_files("/r", "master", explicit="src/a.fpp,src/b.fpp") == {"src/a.fpp", "src/b.fpp"}
264+
265+
266+
def test_sim_include_fpp_forces_all():
267+
# gcov can't reliably attribute #:include'd files; any src include change runs all.
268+
assert is_always_run_all({"src/simulation/include/inline_riemann.fpp"})
269+
assert is_always_run_all({"src/pre_process/include/2dHardcodedIC.fpp"})

0 commit comments

Comments
 (0)