java_fuzzing_engine

Specifies a fuzzing engine that can be used to run Java fuzz targets.

ATTRIBUTES

NameDescriptionTypeMandatoryDefault
nameA unique name for this target.Namerequired
display_nameThe name of the fuzzing engine, as it should be rendered in human-readable output.Stringrequired
launcherA shell script that knows how to launch the fuzzing executable based on configuration specified in the environment.Labelrequired
launcher_dataA dict mapping additional runtime dependencies needed by the fuzzing engine to environment variables that will be available inside the launcher, holding the runtime path to the dependency.Dictionary: Label -> Stringoptional{}
libraryA java_library target that is made available to all Java fuzz tests.LabeloptionalNone

FuzzingEngineInfo

Provider for storing the language-independent part of the specification of a fuzzing engine.

FIELDS

NameDescription
display_nameA string representing the human-readable name of the fuzzing engine.
launcherA file representing the shell script that launches the fuzz target.
launcher_runfilesThe runfiles needed by the launcher script on the fuzzing engine side, such as helper tools and their data dependencies.
launcher_environmentA dictionary from environment variables to files used by the launcher script.

fuzzing_decoration

Generates the standard targets associated to a fuzz test.

This macro can be used to define custom fuzz test rules in case the default cc_fuzz_test macro is not adequate. Refer to the cc_fuzz_test macro documentation for the set of targets generated.

PARAMETERS

NameDescriptionDefault Value
nameThe name prefix of the generated targets. It is normally the fuzz test name in the BUILD file.none
raw_binaryThe label of the cc_binary or cc_test of fuzz test executable.none
engineThe label of the fuzzing engine used to build the binary.none
corpusA list of corpus files.None
dictsA list of fuzzing dictionary files.None
instrument_binary(Experimental, may be removed in the future.)

By default, the generated targets depend on raw_binary through a Bazel configuration using flags from the @rules_fuzzing//fuzzing package to determine the fuzzing build mode, engine, and sanitizer instrumentation.

When this argument is false, the targets assume that raw_binary is already built in the proper configuration and will not apply the transition.

Most users should not need to change this argument. If you think the default instrumentation mode does not work for your use case, please file a Github issue to discuss.
True
define_regression_testIf true, generate a regression test rule.True
test_tagsTags set on the fuzzing regression test.None

java_fuzz_test

Defines a Java fuzz test and a few associated tools and metadata.

For each fuzz test <name>, this macro defines a number of targets. The most relevant ones are:

  • <name>: A test that executes the fuzzer binary against the seed corpus (or on an empty input if no corpus is specified).
  • <name>_bin: The instrumented fuzz test executable. Use this target for debugging or for accessing the complete command line interface of the fuzzing engine. Most developers should only need to use this target rarely.
  • <name>_run: An executable target used to launch the fuzz test using a simpler, engine-agnostic command line interface.

PARAMETERS

NameDescriptionDefault Value
nameA unique name for this target. Required.none
srcsA list of source files of the target.None
target_classThe class that contains the static fuzzerTestOneInput method. Defaults to the same class main_class would.None
transitive_native_depsA list of all native libraries that the fuzz target transitively depends on. The libraries are instrumented automatically and do not need to be mentioned in deps. Listing the libraries in this way is no longer required as of Bazel 5.None
corpusA list containing corpus files.None
dictsA list containing dictionaries.None
engineA label pointing to the fuzzing engine to use.“@rules_fuzzing//fuzzing:java_engine”
tagsTags set on the fuzzing regression test.None
binary_kwargsKeyword arguments directly forwarded to the fuzz test binary rule.none