mozilla / grcov

Rust tool to collect and aggregate code coverage data for multiple source files
Mozilla Public License 2.0
1.17k stars 148 forks source link

Wrong paths in Cobertura report #706

Open refaelsh opened 2 years ago

refaelsh commented 2 years ago

I am seeing wrong/strange paths in Cobertura report. Here is what I do:

❯ grcov . -s src/ --binary-path target/debug/ -t cobertura --ignore-not-existing -o target/debug/coverage.xml

And here is and example of a strange/wrong path in the resulting coverage.xml file:

.
.
.
<package name="/home/refaelsh/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.1/build.rs" line-rate="0" branch-rate="0" complexity="0">
<classes>
<class name="build" filename="/home/refaelsh/.cargo/registry/src/github.com-1ecc6299db9ec823/bitflags-1.2.1/build.rs" line-rate="0" branch-rate="0" complexity="0">
<methods>
<method name="build_script_build::rustc_minor_version" signature="" line-rate="0" branch-rate="0" complexity="0">
<lines>
<line number="17" hits="0"> </line>
.
.
.

Please help :-)

UPDATE: I've noticed that if I add this --ignore "$HOME/.cargo/*" to the grcov command mentioned above, the problem goes away. Now, the question is how did the $HOME/.cargo/* folder got added in the first place?

detly commented 3 months ago

To add to this: