-
Notifications
You must be signed in to change notification settings - Fork 97
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
Code coverage #148
Comments
This is due to the setting of the test coverage filter being set as follows:
This variable is set in the initial environment of I think that computing coverage on all executable files in |
For some reason It does work for the integration tests in |
It took two and a half days on my laptop to run all tests in the current
|
Inspired by @DrPeterVanNostrand's potential bug due to a never-taken branch, I gave coverage a try. Other crates are using some form of coverage (e.g. https://github.com/ctz/rustls does not only feature an awesome logo, but over a hundred lines of custom tooling to enable this functionality), but it is far from trivial to get it working.
Here's what I tried this morning, by trying to get coverage for a toy crate that uses some crates and features we want in hbbft in the future:
Unimplemented
selectingBinder(...)
during trans trying to get coverage rust-lang/rust#52478 in response.-Z profile
, as described by https://users.rust-lang.org/t/howto-generating-a-branch-coverage-report/8524. Note that the compiler patch is no longer necessary, the post is from 2015 and it seems the necessary patches have been merged into mainline rustc.The procedure is quite a bit of work to get going, in the end I did manage to get some output; unfortunately it shows way too much coverage (I got 100% on my first try) and has an issue with macros. As macros are essential (
proptest!
), I do not expect this to work well in practice.master
branch, also usingcargo install
kennytm/cov#22).kcov
manually (https://users.rust-lang.org/t/tutorial-how-to-collect-test-coverages-for-rust-project/650): Segfaults when callingkcov target/cov target/debug/
, at least with my kcov (Debian ships an ancient version 11, when 35 is current, so I had to compile by hand).There are more things to try (e.g. doing a clean step-by-step of https://jbp.io/2017/07/19/measuring-test-coverage-of-rust-programs), but as a whole, I am not very happy about the current state of tooling in this regard.
I am doing something wrong though because shortly before me giving up, this finally worked:
cargo install cargo-make
),cargo test --no-run
to build the tests,cargo make coverage-flow
.Now it is possible to open
target/coverage/index.html
a browser.Probable next steps:
--release
(will take too long otherwise).gh_pages
or using some service like https://coveralls.io/).Comments welcome!
The text was updated successfully, but these errors were encountered: