rust-fuzz / book

📖 Guides and tutorials on how to fuzz Rust code
https://rust-fuzz.github.io/book/
132 stars 22 forks source link

error: Failed to load coverage / book Coverage page specifies the wrong binary path for tutorial. #41

Open cameronelliott opened 9 months ago

cameronelliott commented 9 months ago

Again, thanks to the creators of both the fuzzer and the book. They are both great.

I ran through this tutorial on two systems: https://rust-fuzz.github.io/book/cargo-fuzz/coverage.html

While using the rust-url project for the coverage tutorial.

On both systems, this command from the tutorial was failing: `$ cargo cov -- show fuzz/target//release/my_compiler \ --format=html \ -instr-profile=fuzz/coverage/my_compiler/coverage.profdata \

index.html `

with the error: error: Failed to load coverage: 'fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_target_1': No coverage data found

If you run ls **/fuzz_target_1 You will see there are two binaries.

ls output:

[...]
-rwxrwxr-x 2 c c 22474312 Jan 27 16:57 fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_target_1*
-rwxrwxr-x 2 c c 22787384 Jan 27 16:58 target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/fuzz_target_1

Using the first path, as per the rust-fuzz coverage tutorial will result in the error: error: Failed to load coverage: 'fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_target_1': No coverage data found

using the second path, under target fixed the issue for me on both macos and linux.

the coverage page tutorial should be fixed I suggest the coverage page tutorial be hardcoded to the rust-url example also

please let me know if a PR is desired