-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
LLVM coverage regression in nightly-2022-01-15 #93054
Comments
Reported rust-lang/rust#93054 Technically this isn't affecting all of our projects, but it seemed easier to just pin it here and unpin once fixed. Having it in this one location will make it easier if nightly ever breaks again for any raeason.
We noticed the same when upgrading rustc in our project from tikv/tikv#11875 (comment) suggests that this is probably caused by #92142 |
^ taiki-e/cargo-llvm-cov#128 says |
@rustbot label +requires-nightly +A-code-coverage |
Thanks for the report! I've tried reproducing locally and I'm able to see the same behavior. Running the LLVM tools directly, I see this when trying to process coverage data for the various binaries:
which seems to be the same issue as was reported in a comment on #79645. I'm continuing to investigate ... |
The minimal repro seems to be enum Never { }
impl Never {
fn foo(self) {
match self { }
}
}
fn main() { } I think I'll have a fix for this within the next few days. |
We are pinning it to a version where coverage works. Ref: rust-lang/rust#93054
RUSTC_BOOTSTRAP=1 doesn't work so well anymore in stable, so we had to migrate to nightly - which required us to install the toolchain in an image that already has one. If we install rust manually in a debian-slim, we save ~500MB. We are also pinning nightly to a version where coverage works. Ref: rust-lang/rust#93054
…ov2, r=tmandry Work around missing code coverage data causing llvm-cov failures If we do not add code coverage instrumentation to the `Body` of a function, then when we go to generate the function record for it, we won't write any data and this later causes llvm-cov to fail when processing data for the entire coverage report. I've identified two main cases where we do not currently add code coverage instrumentation to the `Body` of a function: 1. If the function has a single `BasicBlock` and it ends with a `TerminatorKind::Unreachable`. 2. If the function is created using a proc macro of some kind. For case 1, this is typically not important as this most often occurs as a result of function definitions that take or return uninhabited types. These kinds of functions, by definition, cannot even be called so they logically should not be counted in code coverage statistics. For case 2, I haven't looked into this very much but I've noticed while testing this patch that (other than functions which are covered by case 1) the skipped function coverage debug message is occasionally triggered in large crate graphs by functions generated from a proc macro. This may have something to do with weird spans being generated by the proc macro but this is just a guess. I think it's reasonable to land this change since currently, we fail to generate *any* results from llvm-cov when a function has no coverage instrumentation applied to it. With this change, we get coverage data for all functions other than the two cases discussed above. Fixes rust-lang#93054 which occurs because of uncallable functions which shouldn't have code coverage anyway. I will open an issue for missing code coverage of proc macro generated functions and leave a link here once I have a more minimal repro. r? `@tmandry` cc `@richkadel`
I'm interested in a newer nightly to see if that fixes the coverage job - #841 See rust-lang/rust#93054
Between nightly versions 2022-01-14 and 2022-01-15, grcov 0.8.2 lost track of 82% of the coverage of BonsaiDb when using the LLVM coverage option (
-Zinstrument-coverage
).Other projects of mine continue to have code coverage correctly measured. I'm not where to start narrowing this down, as I'm not getting any errors or warnings printed.
Here are the steps to get good code coverage reports out of 2022-01-14:
If you look at the report in the coverage folder, the html report will show >80% coverage. Now, test with the next nightly:
If you look at the report again, the html report now shows < 1% coverage.
The quantity of profraw files are the same, and the sizes of the files are more or less equivalent. I'm not quite sure where to start narrowing this down since it's a unique issue to this project of mine -- but the only unique part I'm aware of is its size 😅.
For now I'll pin our CI to the last working nightly. Thank you in advance for any suggestions or help!
The text was updated successfully, but these errors were encountered: