| load("@bazel_skylib//rules:copy_directory.bzl", "copy_directory") |
| |
| java_test( |
| name = "JazzerFuzzTestExecutorTest", |
| srcs = ["JazzerFuzzTestExecutorTest.java"], |
| deps = [ |
| "//driver/src/main/java/com/code_intelligence/jazzer/junit:jazzer_test_engine", |
| "@maven//:com_google_truth_truth", |
| ], |
| ) |
| |
| [ |
| java_test( |
| name = "RegressionTestTest" + JAZZER_FUZZ, |
| srcs = ["RegressionTestTest.java"], |
| env = { |
| "JAZZER_FUZZ": JAZZER_FUZZ, |
| }, |
| test_class = "com.code_intelligence.jazzer.junit.RegressionTestTest", |
| runtime_deps = [ |
| "//examples/junit/src/test/java/com/example:ExampleFuzzTests_deploy.jar", |
| ], |
| deps = [ |
| "//agent/src/main/java/com/code_intelligence/jazzer/api:hooks", |
| "@maven//:junit_junit", |
| "@maven//:org_junit_jupiter_junit_jupiter_api", |
| "@maven//:org_junit_jupiter_junit_jupiter_engine", |
| "@maven//:org_junit_platform_junit_platform_engine", |
| "@maven//:org_junit_platform_junit_platform_testkit", |
| "@maven//:org_opentest4j_opentest4j", |
| ], |
| ) |
| for JAZZER_FUZZ in [ |
| "", |
| # Any non-empty value disables the regression test and enabled fuzzing. |
| "_fuzzing", |
| ] |
| ] |
| |
| [ |
| java_test( |
| name = "FuzzingWithCrashTest" + JAZZER_FUZZ, |
| srcs = ["FuzzingWithCrashTest.java"], |
| env = { |
| "JAZZER_FUZZ": JAZZER_FUZZ, |
| }, |
| test_class = "com.code_intelligence.jazzer.junit.FuzzingWithCrashTest", |
| runtime_deps = [ |
| "//examples/junit/src/test/java/com/example:ExampleFuzzTests_deploy.jar", |
| ], |
| deps = [ |
| "//agent/src/main/java/com/code_intelligence/jazzer/api:hooks", |
| "@maven//:com_google_truth_extensions_truth_java8_extension", |
| "@maven//:com_google_truth_truth", |
| "@maven//:junit_junit", |
| "@maven//:org_junit_jupiter_junit_jupiter_api", |
| "@maven//:org_junit_jupiter_junit_jupiter_engine", |
| "@maven//:org_junit_platform_junit_platform_engine", |
| "@maven//:org_junit_platform_junit_platform_launcher", |
| "@maven//:org_junit_platform_junit_platform_testkit", |
| "@maven//:org_opentest4j_opentest4j", |
| ], |
| ) |
| for JAZZER_FUZZ in [ |
| "", |
| "_fuzzing", |
| ] |
| ] |
| |
| [ |
| java_test( |
| name = "FuzzingWithoutCrashTest" + JAZZER_FUZZ, |
| srcs = ["FuzzingWithoutCrashTest.java"], |
| env = { |
| "JAZZER_FUZZ": JAZZER_FUZZ, |
| }, |
| test_class = "com.code_intelligence.jazzer.junit.FuzzingWithoutCrashTest", |
| runtime_deps = [ |
| "//examples/junit/src/test/java/com/example:ExampleFuzzTests_deploy.jar", |
| ], |
| deps = [ |
| "//agent/src/main/java/com/code_intelligence/jazzer/api:hooks", |
| "@maven//:com_google_truth_extensions_truth_java8_extension", |
| "@maven//:com_google_truth_truth", |
| "@maven//:junit_junit", |
| "@maven//:org_junit_jupiter_junit_jupiter_api", |
| "@maven//:org_junit_jupiter_junit_jupiter_engine", |
| "@maven//:org_junit_platform_junit_platform_engine", |
| "@maven//:org_junit_platform_junit_platform_testkit", |
| "@maven//:org_opentest4j_opentest4j", |
| ], |
| ) |
| for JAZZER_FUZZ in [ |
| "", |
| "_fuzzing", |
| ] |
| ] |
| |
| [ |
| java_test( |
| name = "ValueProfileTest_" + str(JAZZER_VALUE_PROFILE), |
| srcs = ["ValueProfileTest.java"], |
| env = { |
| "JAZZER_FUZZ": "true", |
| "JAZZER_VALUE_PROFILE": str(JAZZER_VALUE_PROFILE), |
| }, |
| # The test is both CPU-intensive and sensitive to timing, which causes it to be flaky on |
| # slow runners (particularly macOS on GitHub Actions). Since we need to distinguish the two |
| # test variants by whether they find a finding, we can't just increase the timeout without |
| # the risk to make the other variant flaky. |
| tags = ["exclusive"] if JAZZER_VALUE_PROFILE else [], |
| test_class = "com.code_intelligence.jazzer.junit.ValueProfileTest", |
| runtime_deps = [ |
| "//examples/junit/src/test/java/com/example:ExampleFuzzTests_deploy.jar", |
| ], |
| deps = [ |
| "//agent/src/main/java/com/code_intelligence/jazzer/api:hooks", |
| "@maven//:com_google_truth_extensions_truth_java8_extension", |
| "@maven//:com_google_truth_truth", |
| "@maven//:junit_junit", |
| "@maven//:org_junit_jupiter_junit_jupiter_api", |
| "@maven//:org_junit_jupiter_junit_jupiter_engine", |
| "@maven//:org_junit_platform_junit_platform_engine", |
| "@maven//:org_junit_platform_junit_platform_testkit", |
| ], |
| ) |
| for JAZZER_VALUE_PROFILE in [ |
| True, |
| False, |
| ] |
| ] |
| |
| copy_directory( |
| name = "test_resources_root_windows", |
| src = "test_resources_root", |
| out = "test_resources_root", |
| tags = ["manual"], |
| ) |
| |
| [ |
| java_test( |
| name = "DirectoryInputsTest" + JAZZER_FUZZ, |
| srcs = ["DirectoryInputsTest.java"], |
| args = select({ |
| "@platforms//os:windows": [ |
| # --main_advice_classpath isn't passed through Rlocation on Windows, which makes it |
| # impossible to resolve the resources root from runfiles. Instead, we abuse the fact |
| # that execution isn't sandboxed to resolve the regular exec path location relative |
| # to the runfiles root: |
| # .../jazzer/junit/DirectoryInputsTest.runfiles/jazzer --> |
| # .../jazzer/junit/test_resources_root |
| # TODO: Get rid of this hack when https://github.com/bazelbuild/bazel/pull/16227 has |
| # been merged. |
| "--main_advice_classpath=../../test_resources_root", |
| ], |
| "//conditions:default": [ |
| # Add a test resource root containing the seed corpus directory in a Maven layout to |
| # the classpath rather than seeds in a resource directory packaged in a JAR, as |
| # would happen if we added the directory to java_test's resources. |
| "--main_advice_classpath=$(rootpath test_resources_root)", |
| ], |
| }), |
| data = select({ |
| "@platforms//os:windows": [":test_resources_root_windows"], |
| "//conditions:default": ["test_resources_root"], |
| }), |
| env = { |
| "JAZZER_FUZZ": JAZZER_FUZZ, |
| }, |
| test_class = "com.code_intelligence.jazzer.junit.DirectoryInputsTest", |
| runtime_deps = [ |
| "//examples/junit/src/test/java/com/example:ExampleFuzzTests_deploy.jar", |
| ], |
| deps = [ |
| "//agent/src/main/java/com/code_intelligence/jazzer/api:hooks", |
| "@maven//:com_google_truth_extensions_truth_java8_extension", |
| "@maven//:com_google_truth_truth", |
| "@maven//:junit_junit", |
| "@maven//:org_junit_jupiter_junit_jupiter_api", |
| "@maven//:org_junit_jupiter_junit_jupiter_engine", |
| "@maven//:org_junit_platform_junit_platform_engine", |
| "@maven//:org_junit_platform_junit_platform_testkit", |
| ], |
| ) |
| for JAZZER_FUZZ in [ |
| "", |
| "_fuzzing", |
| ] |
| ] |
| |
| [ |
| java_test( |
| name = "AutofuzzTest" + JAZZER_FUZZ, |
| srcs = ["AutofuzzTest.java"], |
| env = { |
| "JAZZER_FUZZ": JAZZER_FUZZ, |
| }, |
| test_class = "com.code_intelligence.jazzer.junit.AutofuzzTest", |
| runtime_deps = [ |
| "//examples/junit/src/test/java/com/example:ExampleFuzzTests_deploy.jar", |
| ], |
| deps = [ |
| "//agent/src/main/java/com/code_intelligence/jazzer/api:hooks", |
| "@maven//:com_google_truth_extensions_truth_java8_extension", |
| "@maven//:com_google_truth_truth", |
| "@maven//:junit_junit", |
| "@maven//:org_junit_jupiter_junit_jupiter_api", |
| "@maven//:org_junit_jupiter_junit_jupiter_engine", |
| "@maven//:org_junit_platform_junit_platform_engine", |
| "@maven//:org_junit_platform_junit_platform_testkit", |
| ], |
| ) |
| for JAZZER_FUZZ in [ |
| "", |
| "_fuzzing", |
| ] |
| ] |