CoordinateFuzzingOpts is a set of arguments for CoordinateFuzzing.
The zero value is valid for each field unless specified otherwise. CacheDir is a directory containing additional "interesting" values.
The fuzzer may derive new values from these, and may write new values here. CorpusDir is a directory where files containing values that crash the
code being tested may be written. CorpusDir must be set. Limit is the number of random values to generate and test. If zero,
there will be no limit on the number of generated values. Log is a writer for logging progress messages and warnings.
If nil, io.Discard will be used instead. MinimizeLimit is the maximum number of calls to the fuzz function to be
made while minimizing after finding a crash. If zero, there will be no
limit. Calls to the fuzz function made when minimizing also count toward
Limit. If MinimizeTimeout and MinimizeLimit are both zero, then
minimization will be disabled. MinimizeTimeout is the amount of wall clock time to spend minimizing
after discovering a crasher. If zero, there will be no time limit. If
MinimizeTimeout and MinimizeLimit are both zero, then minimization will
be disabled. parallel is the number of worker processes to run in parallel. If zero,
CoordinateFuzzing will run GOMAXPROCS workers. Seed is a list of seed values added by the fuzz target with testing.F.Add
and in testdata. Timeout is the amount of wall clock time to spend fuzzing after the corpus
has loaded. If zero, there will be no time limit. Types is the list of types which make up a corpus entry.
Types must be set and must match values in Seed.
func CoordinateFuzzing(ctx context.Context, opts CoordinateFuzzingOpts) (err error)
CorpusEntry represents an individual input for fuzzing.
We must use an equivalent type in the testing and testing/internal/testdeps
packages, but testing can't import this package directly, and we don't want
to export this type from testing. Instead, we use the same struct type and
use a type alias (not a defined type) for convenience.DatabyteGenerationintIsSeedboolParentstringPathstringValuesany
MalformedCorpusError is an error found while reading the corpus from the
filesystem. All of the errors are stored in the errs list. The testing
framework uses this to report malformed files in testdata.(*MalformedCorpusError) Error() string
*MalformedCorpusError : error
Package-Level Functions (total 6)
CheckCorpus verifies that the types in vals match the expected types
CoordinateFuzzing creates several worker processes and communicates with
them to test random inputs that could trigger crashes and expose bugs.
The worker processes run the same binary in the same directory with the
same environment variables as the coordinator process. Workers also run
with the same arguments as the coordinator, except with the -test.fuzzworker
flag prepended to the argument list.
If a crash occurs, the function will return an error containing information
about the crash, which can be reported to the user.
ReadCorpus reads the corpus from the provided dir. The returned corpus
entries are guaranteed to match the given types. Any malformed files will
be saved in a MalformedCorpusError and returned, along with the most recent
ResetCoverage sets all of the counters for each edge of the instrumented
source code to 0.
RunFuzzWorker is called in a worker process to communicate with the
coordinator process in order to fuzz random inputs. RunFuzzWorker loops
until the coordinator tells it to stop.
fn is a wrapper on the fuzz function. It may return an error to indicate
a given input "crashed". The coordinator will also record a crasher if
the function times out or terminates the process.
RunFuzzWorker returns an error if it could not communicate with the
SnapshotCoverage copies the current counter values into coverageSnapshot,
preserving them for later inspection. SnapshotCoverage also rounds each
counter down to the nearest power of two. This lets the coordinator store
multiple values for each counter by OR'ing them together.
The pages are generated with Goldsv0.5.5. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.