-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing source-based coverage for a source file which is supposed to be covered #79456
Comments
Does this properly associate the profraw with the exact binary that produced it? Is it also reproducible when using the llvm-cov tooling? |
Oh, you're right, I was assuming only the source code behind |
Closing as not-a-bug (at least not in rustc). Of course, I agree that having to associate the exact binary with the profile file it produced is sub-optimal, and cargo makes it harder still by appending hashes to everything. That said, this seems like the issue to be fixed in either the LLVM-provided instrumentation runtime (maybe just having a way for it to splice binary name into the profile filename would help?) or in cargo (that's what I'm planning to do for my own use-cases). |
Maybe using |
@marco-c - In case this is helpful... When PR #79109 lands, there will be an update to the "Rust Unstable Book" section on source-based-code-coverage, including an example for coverage of tests run through The example does use You can see the new version in the PR commit, here: Hope this helps. |
@richkadel for now in grcov I'm simply running llvm-cov with the profdata file associated to all possible binary files, not a great solution, but it seems to work... The next step will be to figure out how to use the binary signature to correctly match the profraw to the right binary, but I've looked at the binary signature code in LLVM and it is platform-specific, I'm not too keen on including something like that in grcov. For context, grcov is a tool to parse coverage artifacts (from Rust and other languages). Basically an alternative to This is what I currently suggest doing to people using grcov:
|
As I mentioned in rust-lang/compiler-team#278 (comment), I've implemented support for source-based code coverage in grcov, and started using it to collect coverage for grcov itself.
There is a file that is definitely covered, but doesn't appear to be in the report. It is in the report when using gcov-based coverage.
STR:
LLVM_PROFILE_FILE="grcov-%p-%m.profraw" cargo test
;grcov `find . \( -name "grcov-*.profraw" \) -print\` --binary-path ./target/debug/grcov -s . -t html --branch --ignore-not-existing --ignore "/*" -o coverage
to generate a HTML report (or you can also generate a textual one using the llvm tools);The text was updated successfully, but these errors were encountered: