Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a timout command when running the executable file could cause wrong coverage result #1065

Open
cicilzx opened this issue Jun 27, 2023 · 0 comments

Comments

@cicilzx
Copy link

cicilzx commented Jun 27, 2023

I'm not sure it is a bug or my incorrect behaviour.
Here is what I did:

  1. A simple Rust code:
fn main() {}
  1. Build, run, and get coverage information:
rustc -C instrument-coverage file.rs
./file
grcov . --binary-path ./file -s ./file.rs -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o ./lcov1.info

The rusult goes well, like this:

TN:
SF:
FN:1,file10::main
FNDA:1,file10::main
FNF:1
FNH:1
BRF:0
BRH:0
DA:1,1
DA:2,1
DA:3,1
LF:3
LH:3
end_of_record
  1. But if I add a timeout command like this:
rustc -C instrument-coverage file.rs
timeout 30m ./file
grcov . --binary-path ./file -s ./file.rs -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o ./lcov2.info

The coverage result is output like this:

TN:
SF:
FN:1,file10::main
FNDA:1,file10::main
FNF:1
FNH:1
BRF:0
BRH:0
DA:1,1
DA:2,1
DA:3,1
LF:3
LH:3
end_of_record
SF:
FN:1,file10::main
FNDA:1,file10::main
FNF:1
FNH:1
BRF:0
BRH:0
DA:1,1
DA:2,1
DA:3,1
LF:3
LH:3
end_of_record

I don't understand why there are two end_of_record, and the second group of coverage infomation seems to be odd.
Is this a bug of rustc or grcov? Or is there something wrong with the way I'm doing it that causes the results to be incorrect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant