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

-t html works with -o ./target/debug/coverage/, but -t lcov doesn't #1028

Open
allocgator opened this issue Apr 29, 2023 · 2 comments
Open

Comments

@allocgator
Copy link
Contributor

allocgator commented Apr 29, 2023

From README:

Generate a html coverage report like this:

grcov . -s . --binary-path ./target/debug/ -t html --branch --ignore-not-existing -o ./target/debug/coverage/

N.B.: The --binary-path argument is only necessary for source-based coverage.

You can see the report in target/debug/coverage/index.html.

(or alternatively with -t lcov grcov will output a lcov compatible coverage report that you could then feed into lcov's genhtml command).

indicates that using

grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/coverage/

will create an LCOV file in directory ./target/debug/coverage/, but the directory doesn't actually get created.

The above command throws error:

[ERROR] A panic occurred at /home/saurabh/.local/share/rust/cargo/registry/src/github.com-1ecc6299db9ec823/grcov-0.8.18/src/output.rs:59: Cannot create the file ./target/debug/coverage/ to dump coverage data.

Steps to reproduce

rustup component add llvm-tools-preview
export RUSTFLAGS="-Cinstrument-coverage"
cargo test
grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/coverage/
@marco-c
Copy link
Collaborator

marco-c commented Apr 29, 2023

In case of lcov, the path must be a file and not a directory.

@allocgator
Copy link
Contributor Author

allocgator commented Apr 29, 2023

I tried running

grcov . -s . --binary-path ./target/debug/ -t lcov --branch --ignore-not-existing -o ./target/debug/

and it works. The path is a directory.

I replaced the 4th command in Steps to reproduce with the above.

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

Successfully merging a pull request may close this issue.

2 participants