Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,15 @@ implementation group: 'com.code-intelligence', name: 'jazzer-junit', version: '<

### Bazel

#### Using rules_fuzzing
Jazzer is supported via [rules_fuzzing](https://github.com/bazelbuild/rules_fuzzing), the official Bazel rules for fuzzing.
For setup instructions, see [the README](https://github.com/bazelbuild/rules_fuzzing#java-fuzzing).

With Jazzer set up, you can start writing fuzz tests and benefit from automated bug discovery and improved code coverage.
#### Using JUnit5 integration

It is also possible to use Jazzer+JUnit5 integration directly in Bazel.
An example project can be found [here](https://github.com/CodeIntelligenceTesting/example-bazel-junit).
The [BUILD](https://github.com/CodeIntelligenceTesting/example-bazel-junit/blob/main/BUILD) file showcases how to set up corpus directories for fuzzing and regression and how to pass arguments to Jazzer and libFuzzer.

## Writing fuzz tests

Expand Down Expand Up @@ -170,20 +175,28 @@ If you see an error saying that `libjvm.so` has not been found, make sure that `

## Directories and files

Jazzer uses two directories to store inputs: the *generated corpus directory* and the *inputs directory*.
Jazzer uses two main directories to store inputs: the *generated corpus directory* and the *inputs directory*.

> [!IMPORTANT]
> If you are using Git and want to add the corpus directories to the repository, mark them as `binary` in your `.gitattributes` file:
>
> ```gitattributes
> src/test/resources/** binary
> .cifuzz-corpus/** binary
> ```

### Generated corpus directory

The *generated corpus directory* is where Jazzer saves inputs that generate new coverage during fuzzing.
It is located in `.cifuzz-corpus/<package>/<FuzzTestClass>/<fuzzTestMethod>`, where `<package>`, `<FuzzTestClass>`, and `<fuzzTestMethod>` correspond to the package name, class name, and method name of the fuzz test, respectively.
For example, if the fuzz test is in the class `src/test/java/com/example/ValidFuzzTestsInputs.java`, method `byteFuzz`, the corpus directory is located in `.cifuzz-corpus/com.example.ValidFuzzTestsInputs/byteFuzz`.
For example, if the fuzz test is in the class `src/test/java/com/example/ValidFuzzTests.java`, method `byteFuzz`, the corpus directory is located in `.cifuzz-corpus/com.example.ValidFuzzTests/byteFuzz`.


### Inputs directory

Any input that triggers a crash during fuzzing is saved to the *inputs directory*.
This directory is derived from the package and class name of the fuzz test.
For example, if the fuzz test is in the class `src/test/java/com/example/ValidFuzzTestsInputs.java`, method `byteFuzz`, the *inputs directory* is located in `src/test/resources/com/example/ValidFuzzTestsInputs/byteFuzz`.
For example, if the fuzz test is in the class `src/test/java/com/example/ValidFuzzTests.java`, method `byteFuzz`, the *inputs directory* is located in `src/test/resources/com/example/ValidFuzzTestsInputs/byteFuzz`.
If this directory does not exist, Jazzer will save crash inputs in the directory from which the tests are executed.


Expand Down Expand Up @@ -225,7 +238,7 @@ If you found something interesting and the information is public, please send a

## Further documentation

* [Arguments and Configuration Options](docs/arguments-and-configuration-options.md)
* [Arguments and configuration options](docs/arguments-and-configuration-options.md)
* [Mutation framework](docs/mutation-framework.md)
* [Advanced techniques](docs/advanced.md)
* [Building Jazzer from source](CONTRIBUTING.md)
Expand Down