Documentation ¶
Overview ¶
Package fuzzer contains a test-plan batch fuzzer. It relies on the existence of a single-file fuzzer such as c4f-fuzz.
Index ¶
Constants ¶
const DefaultSubjectFuzzes = 10
DefaultSubjectFuzzes is the default number of fuzz cycles to run per subject.
Variables ¶
var ( // ErrDriverNil occurs when the fuzzer tries to use the nil pointer as its single-fuzz driver. ErrDriverNil = errors.New("driver nil") )
var ErrNotSubjectCycleName = errors.New("not a valid subject-cycle name")
ErrNotSubjectCycleName occurs when we try to ParseSubjectCycle on a string that isn't of the right format.
Functions ¶
This section is empty.
Types ¶
type AggregateDriver ¶
type AggregateDriver struct { // Single is a single-job fuzzer. Single SingleFuzzer // Stat is a stat dumper. Stat litmus.StatDumper }
AggregateDriver is a driver that delegates the interface responsibilities to separate implementations.
type Driver ¶
type Driver interface { SingleFuzzer litmus.StatDumper }
Driver groups the interfaces used to 'drive' parts of the fuzzer.
type Fuzzer ¶
type Fuzzer struct {
// contains filtered or unexported fields
}
Fuzzer holds the state required for the fuzzing stage of the tester.
func New ¶
func New(d Driver, ps SubjectPather, o ...Option) (*Fuzzer, error)
New constructs a fuzzer with the config c and plan p.
type Instance ¶
type Instance struct { // Normalise contains the subject for which this Instance is responsible. Subject subject.Named // Driver is the low-level fuzzer driver set. Driver Driver // SubjectCycles is the number of times each subject should be fuzzed. SubjectCycles int // Machine is the machine, if any, being targeted by the fuzzer. // Knowledge of the machine can be used to shape things like thread counts. Machine *machine.Machine // Config is the specific configuration, if any, for the fuzzer. Config *fuzzer.Config // Pathset points to the pathset to use to work out where to store fuzz output. Pathset SubjectPather // Rng is the random number generator to use for fuzz seeds. Rng *rand.Rand // ResCh is the channel onto which each fuzzed subject should be sent. ResCh chan<- builder.Request }
Instance contains state for a single fuzzer instance.
type Option ¶
Option is the type of options passed to the fuzzer constructor.
func ObserveWith ¶
ObserveWith adds each observer given to the invoker's observer pools.
func OverrideQuantities ¶
OverrideQuantities overrides the fuzzer's quantities with qs.
type Pathset ¶
type Pathset struct { // DirLitmus is the directory to which litmus tests will be written. DirLitmus string // DirTrace is the directory to which traces will be written. DirTrace string }
Pathset contains the pre-computed paths used by a run of the fuzzer.
func NewPathset ¶
NewPathset constructs a new pathset from the directory root.
func (*Pathset) SubjectLitmus ¶
func (p *Pathset) SubjectLitmus(c SubjectCycle) string
SubjectLitmus gets the litmus filepath for the subject/cycle pair c.
func (*Pathset) SubjectTrace ¶
func (p *Pathset) SubjectTrace(c SubjectCycle) string
SubjectTrace gets the litmus filepath for the subject/cycle pair c.
type SingleFuzzer ¶
type SingleFuzzer interface { // Fuzz carries out the given fuzzing job. Fuzz(context.Context, fuzzer.Job) error }
SingleFuzzer represents types that can commune with a C litmus test fuzzer.
type SubjectCycle ¶
type SubjectCycle struct { // Name is the name of the subject. Name string // Cycle is the current fuzz cycle (zero based). Cycle int }
SubjectCycle describes the unique name of a particular instance of the batch fuzzer.
func ParseSubjectCycle ¶
func ParseSubjectCycle(s string) (SubjectCycle, error)
ParseSubjectCycle tries to back-form a SubjectCycle from s.
func (SubjectCycle) String ¶
func (f SubjectCycle) String() string
String is a filepath-suitable string representation of a fuzz name.
type SubjectPather ¶
type SubjectPather interface { // Prepare sets up the directories ready to serve through SubjectPaths. Prepare() error // SubjectLitmus gets the litmus filepath for the subject/cycle pair sc. SubjectLitmus(sc SubjectCycle) string // SubjectTrace gets the trace filepath for the subject/cycle pair sc. SubjectTrace(sc SubjectCycle) string }
SubjectPather is the interface of things that serve file-paths for subject outputs during a fuzz batch.