Thanks to some great work by @euclio, I just released travis-cargo 0.1.15.
This release will pass -C link-dead-code
to the compiler on nightly and beta (and stable from the 1.9 release) when recording code coverage, which makes the code coverage numbers more accurate. Previously functions that were never called at all were likely to be not counted for code coverage in any way, resulting in under-reported coverage numbers (see the discussion thread on internals for more details). Now, these functions are included, and all count as uncovered.
For example, the following two jobs are the exact same source file, the only difference is the compiler version. The first used a compiler that does not support -C link-dead-code
while the second used one does:
- huonw/travis-cargo | Job 14 | src/lib.rs | Coveralls - Test Coverage History & Statistics 100% coverage
-
https://coveralls.io/jobs/14197542/source_files/398912084: 73% + big red marks over the
function3
, which isn't tested.
(The last few functions in that file aren't covered with either compiler because they are killed by #[cfg]
s: they never really existed.)
Hopefully this makes code coverage a more useful measure/tool. Don't be surprised if your numbers drop suddenly!