rust-fuzz / cargo-fuzz

Command line helpers for fuzzing
https://rust-fuzz.github.io/book/cargo-fuzz.html
Apache License 2.0
1.48k stars 108 forks source link

Add `--cfg fuzzing_repro` when reproducing a crash #344

Closed mgeisler closed 1 year ago

mgeisler commented 1 year ago

This makes it possible to leave large or expensive debug output in your fuzzers since it will only be active when you reproduce a crash:

#[cfg(fuzzing_repro)]
eprintln!("Expensive debug output: {}", do_something_expensive());

Fixes #343.

mgeisler commented 1 year ago

LGTM. I don't have a better naming suggestion than fuzzing_repro.

Thanks for merging the PR, I hope it'll be useful to people. I was also not sure what to name this, but I think @Manishearth's suggestion should work okay.