Kogia-sima / rust-covfix

Fix Rust coverage data based on source code
MIT License
14 stars 3 forks source link

Why not fix? #1

Open TriplEight opened 4 years ago

TriplEight commented 4 years ago

Thanks for the great project! And great documentation as well! I've just managed to set it up working with grcov and it actually does report better.

Nevertheless, I wanted to ask: why is it a standalone project and not a contribution to grcov? This and that it is pretty young and doesn't have much stars and maintainers make it less trustworthy and fewer projects will afford using it.

Kogia-sima commented 4 years ago

Hi @TriplEight ! Thanks so much for using rust-covfix and giving me a star :star2:

There are 3 reasons why rust-covfix is developed as standalone package.

  1. A grcov collaborator is aware of rustc reporting incorrect coverage (https://github.com/mozilla/grcov/issues/249#issuecomment-465154051). I'm trying to compare original Rust code and transformed LLVM IR, but still don't fully understand why Rustc report incorrect coverage. The rust-covfix was originally developped as a temporal workaround for this problem until I understand when and where rustc reports incorrect coverage. It is not completely unraveled yet.

  2. grcov is just a coverage collection tool, not a coverage generator. It only aggregates the raw coverage data, and convert the format. It does not read the source code, nor manipulate any coverage data. Also, although grcov is targetting many programming languages such as C/C++, Nim and Rust, rust-covfix only supports Rust.

  3. rust-covfix is targetting not only grcov, but also cargo-kcov and Tarpaulin in the future. Actually, Tarpaulin can now generate the lcov.info. It means rust-covfix is already able to fix the coverage data generated by Tarpaulin. I'm working on feature/cobertura branch to support cargo-kcov too. The final objective is to support these 3 tools.

TriplEight commented 4 years ago

Yeah, I see, thanks for the explanation! Last week I was setting the code coverage for the first time and had to do a little research. If you are interested

If you want some data, you can see our reports here. It's from https://github.com/paritytech/ink

gilescope commented 4 years ago

Would be great to copy paste this explanation into the readme as I am sure everyone wonders this. Great answers btw!

Sent with GitHawk

Kogia-sima commented 4 years ago

@TriplEight @gilescope Thank you all for feedback comments!

Again, rust-covfix is a temporary workaround. It still miss some incorrect line/branch coverages. If you really need a reliable coverage, you may want to disable the branch coverage. Branch coverages are sometimes weird and dishonest (e.g. pattern match context).