kennytm / cov

LLVM-GCOV Source coverage for Rust
MIT License
122 stars 10 forks source link

Coverage report seems to not pick up generic functions #14

Closed mehcode closed 7 years ago

mehcode commented 7 years ago

Is this a known limitation or am I doing something wrong?

Ran

cargo cov clean
cargo cov test
cargo cov report --open

On https://github.com/mehcode/wadatsumi

This crate seems to pick up a lot more than kcov so that's a plus (kcov misses the entire cpu/ directory).

screenshot from 2017-09-20 20-09-49

screenshot from 2017-09-20 20-13-36

It's missing files that are wholly compromised of generics and greys out code that is generics.

kennytm commented 7 years ago

Unfortunately this is a known limitation.

If a generic function is never used, they are not instantiated and won't be sent to LLVM. Coverage information is generated by an LLVM pass. Since LLVM never sees these functions, they will be ignored in the coverage report.

The only solution is to generate coverage information by rustc itself.