-
Notifications
You must be signed in to change notification settings - Fork 109
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
cargo-cov doesn't work #308
Comments
I "solved" this by running llvm-cov manually, like so (also install rustfilt):
Use the llvm-cov binary you made the coverage with. |
hmm, that didn't work for me.
|
I was also getting the For me I had to change |
I tried:
And I get:
|
#!/bin/bash
set -e
# Check if the correct number of arguments is provided
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <fuzz_target>"
exit 1
fi
# Assign the first argument to the fuzz_target variable
FUZZ_TARGET=$1
# Ensure necessary tools are installed
if ! command -v cargo &> /dev/null; then
echo "cargo could not be found, please install Rust and Cargo."
exit 1
fi
if ! command -v llvm-cov &> /dev/null; then
echo "llvm-cov could not be found, please install LLVM."
exit 1
fi
if ! command -v rustfilt &> /dev/null; then
echo "rustfilt could not be found, please install rustfilt."
exit 1
fi
# Run the cargo fuzz coverage command with the provided fuzz target
cargo +nightly fuzz coverage "$FUZZ_TARGET"
# Define the paths
TARGET_DIR="target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release"
PROF_DATA="fuzz/coverage/$FUZZ_TARGET/coverage.profdata"
OUTPUT_FILE="index.html"
# Check if the coverage data file exists
if [ ! -f "$PROF_DATA" ]; then
echo "Coverage data file $PROF_DATA not found."
exit 1
fi
# Generate the coverage report in HTML format
llvm-cov show "$TARGET_DIR/$FUZZ_TARGET" --format=html \
-Xdemangler=rustfilt \
--ignore-filename-regex="\.cargo" \
-instr-profile="$PROF_DATA" \
> "$OUTPUT_FILE"
echo "Coverage report generated as $OUTPUT_FILE" |
@DJDuque I hit the same issue when using my system installed |
I got it running. The insights from fuzzing code coverage are amazing! Well worth the hassle. It's really complicated and confusing. That's what I did to get it running:
Then!
and open the browser and smile. Don't use the compiled binary, go into the |
Command:
Error response:
The text was updated successfully, but these errors were encountered: