Skip to content

cargo: exclude all test code from coverage instrumentation - #10104

Open
thoughtpolice wants to merge 6 commits into
mainfrom
coverage
Open

cargo: exclude all test code from coverage instrumentation#10104
thoughtpolice wants to merge 6 commits into
mainfrom
coverage

Conversation

@thoughtpolice

Copy link
Copy Markdown
Member

I have a branch where I was investigating adding many Hegel proptests across the codebase. My goal was to find bugs and see how coverage increased, but I realized in the midst of that, that we still included far too much test code itself in the coverage report generated by cargo llvm-cov with the default settings (and so adding more hegel tests would skew things). Fix those settings with a default we can all rely on, exclude test modules throughout the codebase from participating in coverage reports, and add some notes on how to run coverage for users (I always forget this).

Checklist

If applicable:

  • I have updated CHANGELOG.md
  • I have updated the documentation (README.md, docs/, demos/)
  • I have updated the config schema (cli/src/config-schema.json)
  • I have added/updated tests to cover my changes
  • I fully understand the code that I am submitting (what it does,
    how it works, how it's organized), including any code drafted by an LLM.
  • For any prose generated by an LLM, I have proof-read and copy-edited with
    an eye towards deleting anything that is irrelevant, clarifying anything
    that is confusing, and adding details that are relevant. This includes,
    for example, commit descriptions, PR descriptions, and code comments.

This is just a nice shorthand for running `llvm-cov` with some options
that exclude some "extra" code (testing, build.rs, etc) that the default
exclusions do not pick up, which slightly perturbs the numbers.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Used in upcoming diffs to reduce coverage reports over test code.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
Signed-off-by: Austin Seipp <aseipp@pobox.com>
Signed-off-by: Austin Seipp <aseipp@pobox.com>
Signed-off-by: Austin Seipp <aseipp@pobox.com>
Also adds a note on excluding test modules from reports.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
@thoughtpolice
thoughtpolice requested a review from a team as a code owner September 2, 2026 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant