mozilla / grcov

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

grcov get more excute times #1151

Open yuhui518 opened 9 months ago

yuhui518 commented 9 months ago

1.cargo new hello_world 2.RUSTFLAGS="-C instrument-coverage" cargo cuild 3.cd target/debug && ./hello_world

  1. grcov ./target/debug --binary-path ./target/debug -s . -t html --ignore-not-existing -o ../cov/ then,the result is: image image

Next, I use the llvm-cov tool to get the same profraw file's code covrage,the result is: image image

I just only excute the "hello_world" binary one times, the grcov's result is three times, and the llvm-cov's result is correct.

### Tasks
yuhui518 commented 9 months ago

The llvm-cov's command is: 1.cd target/debug 2.llvm-profdata merge -sparse *.profraw -o json5format.profdata 3.cd ../.. 4.. llvm-cov report --use-color --ignore-filename-regex='/.cargo/registry' --instr-profile=target/debug/json5format.profdata --object target/debug/hello_world

  1. llvm-cov show --use-color --ignore-filename-regex='/.cargo/registry' --instr-profile=target/debug/json5format.profdata --object target/debug/hello_world --show-instantiations --show-line-counts-or-regions