Kogia-sima / rust-covfix

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

Investigate -Zinstrument-coverage flag #6

Open Kogia-sima opened 3 years ago

Kogia-sima commented 3 years ago

document link: https://github.com/rust-lang/rust/blob/6d949112f624616db58ecf12b8acb08b82d22758/src/doc/unstable-book/src/compiler-flags/source-based-code-coverage.md

TriplEight commented 3 years ago

Hi @Kogia-sima , Your tool has helped me again with fixing the coverage, source-based this time. I think this could help you with your investigation.

Have to admit, it's uneasy to understand grcov's documentation, so I'm experimenting. This is how rust-covfix fixes the coverage:

  line:   82.90% (17575 of 21201 lines)    => 81.86% (8056 of 9841 lines)
  branch: NaN% (0 of 0 branches) => NaN% (0 of 0 branches)

Even though I've passed --branch to grcov.

This is a comparison before covfix and after

Kogia-sima commented 3 years ago

@TriplEight Thanks!

TriplEight commented 3 years ago

There's an explanation of why branch coverage is 0: https://github.com/mozilla/grcov/issues/520