-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Source-code based coverage is failing to identify some executable lines #83985
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
Comments
@rustbot label: +A-code-coverage |
Thanks for the bug report @wpbrown ! There was a recent bug fix (PR #83774) that addresses most of the missing coverage in your example (except for the last one). I just tested with
I was surprised to see no coverage for line 169, and I do see the So as of today, this issue is still a bug that I will need to look into further:
|
cc: @tmandry @wesleywiser Note, here is a snippet showing the missing coverage and code relevant to its codepath. I haven't thoroughly investigated this. I should be able to reproduce this in a simplified test (without the async_trait and executor dependencies) that I can add to our unit tests. I don't have a theory yet. It could either be the closure's MIR is not included in coverage (seems unlikely to me), or The test (shown at the bottom) calls and awaits the implementation of
I do see the test output, including the
The async closure seems to be missing coverage, as shown here. Note the wrapper function is covered and called (showing the coverage of Since the program output proves this is called, the coverage should be showing
And the test that invokes it is covered:
|
Thank you. I see improvement in the latest nightly. I minified the test case to the async issues for anyone looking at this (but it still uses executor and async_trait.) https://github.com/wpbrown/rust-codecov/blob/async_reduce/codecovsample/src/main.rs Since this function is missing coverage too the issue isn't specific to async_trait thought.
|
So it turns out that the internal (auto-generated) closure actually does get coverage, but for some reason the code region for the rust/src/test/run-make-fulldeps/coverage-reports/expected_show_coverage.async2.txt Lines 9 to 34 in 3ece606
|
Update: #84323 fixes the issue. |
coverage of async function bodies should match non-async This fixes some missing coverage within async function bodies. Commit 1 demonstrates the problem in the fixed issue, and commit 2 corrects it. Fixes: rust-lang#83985
I tried to generate test code coverage with this source file using
-Zinstrument-coverage
and the LLVM tools.Source File:
https://github.com/wpbrown/rust-codecov/blob/main/codecovsample/src/main.rs
I expected to see this happen:
76% line coverage
Instead, this happened:
83% line coverage
.cargo-kcov, -Zprofile+grcov, and tarpaulin agree on 76%.
In the output below lines
65-67
,116-118
,163-165
were not executable but should have been executable+uncovered. Line169-170
should be executable+covered.coverage output
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: