-
-
Notifications
You must be signed in to change notification settings - Fork 7
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
No coverage information generated #20
Comments
Hi, thanks for the report -- completely missed this earlier. This is very strange. I got around to adding coverage for datatest-stable itself, and it seems to work fine: https://app.codecov.io/github/nextest-rs/datatest-stable/commit/ff0bbaf8923cdcb8621bafa459ad11589085845a/tree/src. (But this is within the same crate.)
Do you have a minimal reproduction example? |
@sunshowers I created a minimal example repo here: https://github.com/zaneduffield/datatest_coverage_issue Please let me know if you can reproduce the issue with this. |
I realized that my cargo-llvm-cov was out of date (0.5.3). I updated it to the latest version, 0.6.9, and still see the same results. |
I thought that might be the case 😢. I'll close this here for now since it doesn't seem like the fault of |
Ahh -- Windows is interesting! There might definitely be something weird going on there. Would definitely be curious to learn if you find out more. |
I think I worked out the problem. Line 17 in 719600d
Internally, this function calls From the documentation of
I have a feeling that (maybe just on Windows), something is depending on destructors being terminated on some thread. When I return For example, if I use this as my main function I get no coverage use std::{path::PathBuf, process::ExitCode};
use libtest_mimic::{Arguments, Trial};
fn main() {
let args = Arguments::from_args();
libtest_mimic::run(
&args,
vec![Trial::test("foo", || {
call_fn_to_cover(&PathBuf::new()).unwrap();
Ok(())
})],
).exit();
} but if I change it to use use std::{path::PathBuf, process::ExitCode};
use libtest_mimic::{Arguments, Trial};
fn main() -> ExitCode {
let args = Arguments::from_args();
let result = libtest_mimic::run(
&args,
vec![Trial::test("foo", || {
call_fn_to_cover(&PathBuf::new()).unwrap();
Ok(())
})],
);
if result.has_failed() {
ExitCode::from(101)
} else {
ExitCode::SUCCESS
}
} |
Aha! Yes that would explain it, wouldn't it. Worth filing in libtest-mimic, and honestly might be a bug in Rust itself. |
I've fixed this in 33d4725, planning to get a release out very soon. |
Meanwhile could you try patching that in locally and ensuring it works? |
Yep, with this patch coverage is generated successfully. [patch.crates-io]
datatest-stable = { git = "https://github.com/nextest-rs/datatest-stable/", rev = "33d4725463e839060c70254b0c879ad5e27a3cfb" } Thanks for fixing this 😄. Do you still think I should raise this with I wouldn't really know if this is worth raising with |
Awesome, datatest-stable 0.2.5 should be out in a few. I think it's absolutely worth raising with libtest-mimic, yeah. Other custom harnesses are going to run into this. Personally I'd consider deprecating The MSRV for As far as Rust or llvm goes, probably not, but I think it's worth getting this documented in llvm-cov. Windows is a relatively rare OS for Rust dev and Thanks again and great job on the investigation! |
FYI @sunshowers |
Thanks. Needs LukasKalbertodt/libtest-mimic#40 to be fixed to use it. |
@zaneduffield released datatest-stable 0.2.6 with libtest-mimic 0.7.2. Thanks. |
I'm not sure if this is just some kind of user error, but I can't see to get coverage information generated for my datatests.
Coverage information is being generated, but it only seems to contain the hits from the non-
datatest
tests. When I clear the '*.profraw' files and run just thedatatest
tests, there is 0% coverage.Initially I tried running
cargo llvm-cov --html
, then I tried following the steps for external tests but that didn't work either.What might make my use-case a bit unusual is the fact that the
datatest
tests are in their own crate in the workspace, and I'm expecting coverage information to be generated for another crate in the workspace.I thought this structure could be part of the problem, so I tried replacing the
datatest_stable::harness!
macro with amain
function that directly calls a function from the other crate, and then coverage information was successfully generated.Any help on this issue would be greatly appreciated.
The text was updated successfully, but these errors were encountered: