rules_fuzzing
rules_fuzzing copied to clipboard
How do you run a cc_fuzz_test() against a specific input?
Expected Behavior
I can run the fuzz test against a known input, as described here: https://google.github.io/oss-fuzz/advanced-topics/reproducing/#fuzz-target-bugs
Actual Behavior
When I run the fuzz test, I get the following output:
mkdir: cannot create directory ‘/corpus’: Permission denied
mkdir: cannot create directory ‘/artifacts’: Permission denied
bazel-bin/upb/fuzz/file_descriptor_parsenew_fuzzer: line 12: /usr/local/google/home/haberman/code/upb/../rules_fuzzing/fuzzing/engines/libfuzzer_launcher.sh: No such file or directory
Steps to Reproduce the Problem
$ git clone https://github.com/protocolbuffers/upb.git
$ cd upb
$ bazel build -c opt --config=asan-libfuzzer upb/fuzz:file_descriptor_parsenew_fuzzer
$ bazel-bin/upb/fuzz/file_descriptor_parsenew_fuzzer /dev/null
mkdir: cannot create directory ‘/corpus’: Permission denied
mkdir: cannot create directory ‘/artifacts’: Permission denied
bazel-bin/upb/fuzz/file_descriptor_parsenew_fuzzer: line 12: /usr/local/google/home/haberman/code/upb/../rules_fuzzing/fuzzing/engines/libfuzzer_launcher.sh: No such file or directory
Specifications
- Version: 0.3.1: https://github.com/protocolbuffers/upb/blob/main/WORKSPACE#L52
- Platform: Linux
cc @ericsalo
Either of the following should work:
bazel run -c opt --config=asan-libfuzzer upb/fuzz:file_descriptor_parsenew_fuzzer_run -- --regression=true --corpus_dir= /some/file
bazel run -c opt --config=asan-libfuzzer upb/fuzz:file_descriptor_parsenew_fuzzer_bin /some/file
The *_run target is a Python launcher that accepts engine-agnostic arguments, *_bin gives you the raw libFuzzer binary.
Can documentation be added to the user guide for this?