cargo-fuzz
cargo-fuzz copied to clipboard
Merging raw coverage files failed / links to "installing llvm coverage tools" dead
I was following this tutorial, but running cargo +nightly fuzz coverage <my-fuzz-target> failed with:
Merging raw coverage data...
Error: Merging raw coverage files failed.
Do you have LLVM coverage tools installed?
https://doc.rust-lang.org/beta/unstable-book/compiler-flags/source-based-code-coverage.html#installing-llvm-coverage-tools
Caused by:
0: Failed to run command: "/home/me/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/bin/llvm-profdata" "merge" "-sparse" "/home/me/git/RustExperiments/SerdeChecks/fuzz/coverage/deserialize/raw" "-o" "/home/me/git/RustExperiments/SerdeChecks/fuzz/coverage/deserialize/coverage.profdata"
1: No such file or directory (os error 2)
I'm wondering why it is trying to use llvm-profdata from that path, which is indeed non-existing. In general which llvm-profdata would point to the right location.
Unfortunately, the relevant link (https://doc.rust-lang.org/beta/unstable-book/compiler-flags/source-based-code-coverage.html#installing-llvm-coverage-tools) that is mentioned both in the error, but also in the tutorial seems to be dead.
I looks like I got it to work via:
cargo install cargo-binutils
rustup +nightly component add llvm-tools-preview
I assume that this was the missing piece in the documentation.