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

Compute coverage after fuzz runs #222

Open
andreeaflorescu opened this issue Feb 6, 2023 · 0 comments
Open

Compute coverage after fuzz runs #222

andreeaflorescu opened this issue Feb 6, 2023 · 0 comments
Labels
help wanted Extra attention is needed

Comments

@andreeaflorescu
Copy link
Member

We should compute the coverage after running fuzzing in PRs. This way we can catch if any new functions are added to the code that are not called during fuzzing, and thus we can adapt the fuzz targets.

For running coverage we will probably need to update the rust-vmm-container to add the required tools. To gather the coverage information for fuzzing for the Fosdem talk (https://fosdem.org/2023/schedule/event/vai_fuzzing_device_models/) I've used the following commands:

# Gather coverage information from fuzz corpus:
cargo +nightly fuzz coverage virtio_queue

# Get the coverage information (as a report):
 llvm-cov report --instr-profile coverage/virtio_queue/coverage.profdata target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/virtio_queue --ignore-filename-regex='/.cargo/registry'

# Show detailed information about the coverage per file:
llvm-cov show -Xdemangler=rustfilt target/x86_64-unknown-linux-gnu/coverage/x86_64-unknown-linux-gnu/release/virtio_queue -instr-profile=coverage/virtio_queue/coverage.profdata    -show-line-counts-or-regions   --ignore-filename-regex='/.cargo/registry'

These commands can be extended in a separate test that receives as a parameter the fuzz target name and can output the coverage details.

@andreeaflorescu andreeaflorescu added the help wanted Extra attention is needed label Feb 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

1 participant