nextest-rs / nextest

A next-generation test runner for Rust.
https://nexte.st
Apache License 2.0
2.11k stars 92 forks source link

Compatibility with coverage tools? #56

Closed pwoolcoc closed 2 years ago

pwoolcoc commented 2 years ago

Is there any way to use this in conjunction with coverage tools? Maybe it would be better to go see if the coverage tool has support for this rather than the other way around, but if someone here has gotten nextest working with a coverage tool I'd love to hear about it.

sunshowers commented 2 years ago

I'm not aware of any current efforts, but I'd certainly welcome some discussion about it. My ideal solution would involve not baking the specifics of a particular coverage tool into nextest itself, and having some sort of inter-process protocol to communicate with a daemon as necessary instead.

pwoolcoc commented 2 years ago

turns out it works just fine with rustc's built-in instrumentation and llvm's coverage tools. Repo is here: https://github.com/pwoolcoc/nextest-cov-example, output looks like:

image

I used the docs here to get this all working: https://doc.rust-lang.org/nightly/rustc/instrument-coverage.html

skyzh commented 2 years ago

I'm working on integrating nextest with llvm-cov. https://github.com/taiki-e/cargo-llvm-cov/pull/144

If the above PR gets merged, generating coverage with nextest should be as simple as cargo llvm-cov nextest

sunshowers commented 2 years ago

@skyzh that's awesome! thank you

skyzh commented 2 years ago

https://github.com/taiki-e/cargo-llvm-cov/pull/144 is now merged, maybe we can update docs and close this issue?

sunshowers commented 2 years ago

maybe we can update docs and close this issue?

Thanks again for getting this upstream! llvm-cov is one of several coverage tools one might want to use, so let's try and write up some generic documentation for this as well before closing this issue.

sunshowers commented 2 years ago

https://github.com/nextest-rs/nextest/pull/119 has more documentation + an example.

sunshowers commented 2 years ago

https://nexte.st/book/test-coverage.html has the documentation! Thanks everyone. If you've integrated nextest into your own coverage tool, please feel free to send a PR with documentation.