[−][src]Function fuzzcheck::launch
pub fn launch<T, F, M, S>(
test: F,
mutator: M,
serializer: S
) -> Result<(), Error> where
T: ?Sized,
M::Value: Borrow<T>,
F: Fn(&T) -> bool,
M: Mutator,
S: Serializer<Value = M::Value>,
Fuzzer<T, F, M, S>: 'static,
Fuzz-test the given test function, following to the command-line arguments provided by the cargo-fuzzcheck tool.
-
The first argument is a function
fn(T) -> bool
to fuzz-test. It is only allowed to use the main thread. If it tries to perform asynchronous operations, the fuzzing engine will be confused and act in unpredictable ways. -
The second argument is a mutator for values of type
T
. See the Mutator trait for more information. Some basic mutators are provided by the fuzzcheck_mutators crate. -
The third argument is a serializer for values of type
T
. See the Serializer trait for more information. Some basic serializers are provided by the fuzzcheck_serializer crate.
This function will either:
-
never return
- the fuzz-test does not find any crash and continuously keeps running
- if a test failure or crash is detected
- if the command line arguments could not be parsed. It will then print the help section of cargo-fuzzcheck and exit.
-
return
Ok(())
if the maximum number of iterations has been reached -
return an error if some necessary IO operation could not be performed. You do not need to catch or handle the error.