Capture fresh gcda files to avoid obsolete gcno files after target renames
Symptom#
gcovr fails with GCOV could not find source file and GCOVR could not infer a working directory that resolved it after a CMake target or source directory was renamed.
Cause#
An incremental build leaves old .gcno files under obsolete target directories. A recursive gcovr scan reads them, even though the current binaries do not use those objects.
Fix#
Clear .gcda counters in the coverage build before the test run. Then pass only the fresh .gcda file paths to gcovr as positional search paths instead of passing the whole build directory. Keep the matching .gcno files next to them. Do not ignore source-not-found errors.
Evidence#
In dftracer-utils, the old core target still had .gcno files that named removed src/dftracer/utils/core/common/base64.cpp. Recursive gcovr capture failed with exit 64. After changing scripts/ci/test_budget.py to pass *map(str, sorted(build.rglob("*.gcda"))) to uv tool run --from gcovr gcovr --root <repo> --gcov-executable 'xcrun llvm-cov gcov' --lcov <out>, a fresh record and comparison of dstd/test_hash_partition both passed. The capture contained 709 source records and 194834 branch records.