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

How do you run a cc_fuzz_test() against a specific input? #214

Open
haberman opened this issue Oct 14, 2022 · 2 comments
Open

How do you run a cc_fuzz_test() against a specific input? #214

haberman opened this issue Oct 14, 2022 · 2 comments

Comments

@haberman
Copy link

haberman commented Oct 14, 2022

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

cc @ericsalo

@fmeum
Copy link
Member

fmeum commented Oct 14, 2022

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.

@haberman
Copy link
Author

Can documentation be added to the user guide for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants