Skip to content

Commit

Permalink
Add FuzzedDataProvider fuzz tests
Browse files Browse the repository at this point in the history
  • Loading branch information
br-lewis committed Sep 6, 2023
1 parent f6cf799 commit 7a8d62d
Show file tree
Hide file tree
Showing 11 changed files with 900 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fuzzing-featured.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
shell: bash
- id: build-jazzer
name: Build Jazzer deps
run: cd $CHECKOUT_DIR && bazel build //deploy:jazzer-junit-project //deploy:jazzer-project //deploy:jazzer-api-project //selffuzz:jazzer_selffuzz
run: cd $CHECKOUT_DIR && bazel build //deploy:jazzer-junit-project //deploy:jazzer-project //deploy:jazzer-api-project //selffuzz:jazzer_selffuzz //selffuzz:jazzer_api_selffuzz

- id: build-fuzzers
name: Build Fuzzers
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzzing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
shell: bash
- id: build-jazzer
name: Build Jazzer deps
run: cd $CHECKOUT_DIR && bazel build //deploy:jazzer-junit-project //deploy:jazzer-project //deploy:jazzer-api-project //selffuzz:jazzer_selffuzz
run: cd $CHECKOUT_DIR && bazel build //deploy:jazzer-junit-project //deploy:jazzer-project //deploy:jazzer-api-project //selffuzz:jazzer_selffuzz //selffuzz:jazzer_api_selffuzz

- id: build-fuzzers
name: Build Fuzzers
Expand Down
7 changes: 7 additions & 0 deletions selffuzz/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,10 @@ jar_jar(
rules = "selffuzz_shade_rules.jarjar",
visibility = ["__subpackages__"],
)

jar_jar(
name = "jazzer_api_selffuzz",
input_jar = "//src/main/java/com/code_intelligence/jazzer/api:api",
rules = "selffuzz_shade_rules.jarjar",
visibility = ["__subpackages__"],
)
7 changes: 7 additions & 0 deletions selffuzz/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,13 @@
<scope>system</scope>
<systemPath>${project.basedir}/../bazel-bin/selffuzz/jazzer_selffuzz.jar</systemPath>
</dependency>
<dependency>
<groupId>com.code-intelligence.selffuzz</groupId>
<artifactId>jazzer-api</artifactId>
<version>dev</version>
<scope>system</scope>
<systemPath>${project.basedir}/../bazel-bin/selffuzz/jazzer_api_selffuzz.jar</systemPath>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions selffuzz/selffuzz_shade_rules.jarjar
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# this is loaded in a special way at runtime and so we can't shade it but it should be safe to share between selffuzz
# and normal jazzer. In order to not shade it, we make a rule to transform it to itself and then have the
# general rule because a file will be transformed by the first rule where it fits the filter
rule com.code_intelligence.jazzer.utils.UnsafeProvider com.code_intelligence.jazzer.utils.UnsafeProvider
rule com.code_intelligence.jazzer.** com.code_intelligence.selffuzz.jazzer.@1
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
load("//bazel:fuzz_target.bzl", "java_fuzz_target_test")

# Mutator fuzz tests define a low `runs` to only start and iterate
# a few times via Bazel. Long running fuzzing is executed in CI Sense through
# the CI pipeline integration.

java_fuzz_target_test(
name = "FuzzedDataProviderImplFuzzTest",
srcs = ["FuzzedDataProviderImplFuzzTest.java"],
fuzzer_args = [
"--experimental_mutator",
"-runs=1000",
],
target_class = "com.code_intelligence.selffuzz.driver.FuzzedDataProviderImplFuzzTest",
verify_crash_reproducer = False,
deps = [
"//selffuzz:jazzer_api_selffuzz",
"//selffuzz:jazzer_selffuzz",
"//src/main/java/com/code_intelligence/jazzer/driver:fuzzed_data_provider_impl",
"//src/main/java/com/code_intelligence/jazzer/junit:fuzz_test",
"//src/main/java/com/code_intelligence/jazzer/mutation/annotation",
"//src/main/native/com/code_intelligence/jazzer/driver:jazzer_fuzzed_data_provider",
"@maven//:org_junit_jupiter_junit_jupiter_api",
"@maven//:org_junit_jupiter_junit_jupiter_engine",
"@maven//:org_junit_platform_junit_platform_launcher",
],
)
Loading

0 comments on commit 7a8d62d

Please sign in to comment.