Closed mdeering24 closed 2 months ago
My first thought is that you specified a different LLVM version of llvm-profdata (https://github.com/taiki-e/cargo-llvm-cov/issues/362) or linked a C binary built with another LLVM version with coverage-related compilation flags enabled, but given that 797582847 is clearly an unusual value, the problem may be somewhere else.
In any case, this issue needs a reproduction. It is always difficult to investigate an issue unless I can reproduce it on my end.
So on my simpler project that previous had code coverage working, I added Bevy to it and now its not working. So there is probably some issue with those dependencies or its my system. If you do want to look into it more I uploaded the repo here: https://github.com/mdeering24/coverage_debugging
cargo llvm-cov --lcov --output-path ./coverage/lcov.info
Finished `test` profile [optimized + debuginfo] target(s) in 1.57s
Running unittests src/main.rs (target\llvm-cov-target\debug\deps\code_coverage-fa9d433ff32f3e68.exe)
running 1 test
test test::test_double ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
LLVM Profile Error: Runtime and instrumentation version mismatch : expected 9, but get 867837439
Finished report saved to ./coverage/lcov.info
Thanks for the repro. I can reproduce this on the latest nightly on Windows, and I can't reproduce this on macOS, so I'm marking this as Windows-specific issue.
This is a rustc (or LLVM) bug that occurs when there is a dylib crate in dependencies on windows-msvc (https://github.com/rust-lang/rust/issues/124372).
Workaround for your case is disabling the dynamic_linking
feature of bevy.
Closing in favor of upstream bug report.
Thanks for looking into this. I appreciate it
I am trying to use this to generate code coverage for a Bevy project. I am getting the below error and getting zero percent code coverage reports, which isn't true:
LLVM Profile Error: Runtime and instrumentation version mismatch : expected 9, but get 797582847
I have tried cleaning the project and rebuilding multiple times and confirmed that this does work on a simpler project with no dependencies. I'm not really sure if this is my system, the project, or cargo-llvm-cov.
` rustc --version --verbose rustc 1.79.0-nightly (e3181b091 2024-04-18) binary: rustc commit-hash: e3181b091e88321f5ea149afed6db0edf0a4f37b commit-date: 2024-04-18 host: x86_64-pc-windows-msvc release: 1.79.0-nightly LLVM version: 18.1.4
cargo --version --verbose cargo 1.79.0-nightly (6f06fe908 2024-04-16) release: 1.79.0-nightly commit-hash: 6f06fe908a5ee0f415c187f868ea627e82efe07d commit-date: 2024-04-16 host: x86_64-pc-windows-msvc libgit2: 1.7.2 (sys:0.18.3 vendored) libcurl: 8.6.0-DEV (sys:0.4.72+curl-8.6.0 vendored ssl:Schannel) os: Windows 10.0.22631 (Windows 11 Professional) [64-bit]
cargo llvm-cov --version cargo-llvm-cov 0.6.9 `