Add --coverage (gcov instrumentation + gcovr report) - #62
Merged
Conversation
--coverage instruments the build for gcov coverage (the gcc/clang `--coverage` driver flag on compile and link), in its own build-dir variant build_<profile>_coverage (composing before any sanitizer tag, matching Blade's variant suffix). Like sanitizers, it's threaded through Options/plan/buildDirFor and honored by build/test/run/clean/dump. (--gcov is deprecated and stays ignored.) After a `blade test --coverage` run the tests have written .gcda; the runner then reports via gcovr (best-effort -- warns, never fails, if gcovr is absent). Matching Blade's coverage.py: clang gcov data is read with `llvm-cov gcov` (on macOS via `xcrun`, since Apple's `c++` is clang but its data needs the matching llvm-cov), and coverage_config.exclude globstar patterns become gcovr -e regexes. macOS/llvm-cov emits absurd "suspicious" hit counts (gcc bug 68080), so the suspicious-hits threshold is raised to keep the report clean. Verified on flare (macOS/clang): `test //flare/base:chrono_test --coverage` builds into build_release_coverage, runs, and prints the gcovr summary (TOTAL ... 12%). Unit tests cover the build-dir variants and the glob->regex translation. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Wave-2 item from #54 (
--gcovis deprecated → stays ignored).What
--coverageinstruments the build for gcov coverage (the gcc/clang--coveragedriver flag on compile and link), in its own build-dir variantbuild_<profile>_coverage(composing before any sanitizer tag, matching Blade's variant suffix). Threaded throughOptions/plan/buildDirFor; honored bybuild/test/run/clean/dump.Report
After
blade test --coverage, the runner reports via gcovr (best-effort — warns, never fails, if gcovr is absent). Matching Blade'scoverage.py:llvm-cov gcov; on macOS viaxcrun(Apple'sc++is clang but the name doesn't say so — detected via--version— and its data needs the matching llvm-cov).coverage_config.excludeglobstar patterns → gcovr-eregexes.Verified on flare (macOS/clang)
test //flare/base:chrono_test --coverage→ builds intobuild_release_coverage, runs, prints the gcovr summary (TOTAL … 12%). Unit tests cover the build-dir variants (incl.build_release_coverage_asan+ubsan) and the glob→regex translation.Refs #54 (Wave 2).
🤖 Generated with Claude Code