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

Coverage report information is very out of date #39

Open
mumbleskates opened this issue Jan 25, 2024 · 2 comments
Open

Coverage report information is very out of date #39

mumbleskates opened this issue Jan 25, 2024 · 2 comments

Comments

@mumbleskates
Copy link

mumbleskates commented Jan 25, 2024

The commands described in the coverage page for generating a coverage report, or doing anything at all with the profdata files collected, are obsolete; none of the replacement or alternative commands seem to accept those arguments. For example, cargo-cov seemingly no longer has a "show" command at all.

one command that does seem to work is

llvm-cov show --format=html -Xdemangler=rustfilt \
 --instr-profile=fuzz/coverage/fuzz_target_binary/coverage.profdata \
 target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/fuzz_target_binary \
 . \
 > coverage.html

but for various reasons this might not be ideal.

@cameronelliott
Copy link

I'm not a maintainer on this project, but I just went through the tutorials twice myself. Once on macos, and once on linux.

I ran into a similar issue.

I think, but am not certain that the issue you ran into, is that the cargo cov problem you ran into is not having the correct cargo subcommand installed.

The correct way I set this up was like this cargo install cargo-binutils.

I did actually install the wrong subcommand cargo install cargo-cov, which caused me to dig into my working rust-fuzz tutorial macos setup to discover I needed cargo-binutils not cargo-cov.

With that subcommand install, the tutorial works fine, with one other tweak I will file an issue on. (you need to tweak the path to the binary)
The rust-fuzz book coverage page should explicitly mention needing cargo install cargo-binutils in order for the cargo cov to launch the correct subcommand.
The rust-fuzz book coverage page does mention "installing LLVM-coverage tools", and on the linked rustc book page it causually mentions "In this case, you may also find cargo-binutils useful as a wrapper around these tools."
But IMHO it's not enough...

I will file an issue.

@mumbleskates
Copy link
Author

yeah, i already have LLVM-coverage tools installed. i have the whole LLVM-19 suite, so i was eventually able to figure out getting a coverage report directly with the underlying tools, as in the above example...

that's good to know that there is a different cargo subcommand entirely, in cargo-binutils. cargo search doesn't even find that one and it doesn't seem to be mentioned anywhere.

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

2 participants