libfuzzer
libfuzzer copied to clipboard
Added setup and teardown for fuzzers.
Added fuzz_setup and fuzz_teardown macros, where setup and teardown lambdas can be detailed in order to e.g. start and stop a server thread that is to be subject to fuzzing.
The libFuzzer changes should be implemented upstream first. It is desirable to not diverge from upstream libFuzzer at all.
yeah, considering this is a crate for libfuzzer, if libfuzzer (upstream) doesn't support it, seems like it shouldn't be added here. maybe this is something we could add to cargo fuzz? i'm not sure, i don't have any great ideas
Agree; that was my initial attempt (adding the functionality to cargo fuzz, that is), but I couldn't come up with something that wasn't too ugly. One option could perhaps using a statoc. amd RAII to manage setup/teardown. That way the functionality could be isolated to src/llib.rs. Would you be interested in something along that line, if I manage to whip something up?
Just going to point out that I've read your message, but I really don't know the best course of action for this. @nagisa might have some ideas for this.
Hello, I have a very similar problem. I want to run fuzzer, but before running the fuzzer, I need to execute some preparations, which should be executed only once, before fuzzing itself. Is there any progress with setup & teardown proposal?
You can use https://doc.rust-lang.org/nightly/std/sync/struct.Once.html to run one-time initialization code.
Going to close this PR as it is quite bit rotted at this point. Feel free to open an issue with any feature requests / more discussion if wanted.