tavor: github.com/zimmski/tavor/fuzz/strategy Index | Files

package strategy

import "github.com/zimmski/tavor/fuzz/strategy"

Index

Package Files

allpermutations.go almostallpermutations.go permuteoptionals.go random.go strategy.go

func List Uses

func List() []string

List returns a list of all registered fuzzing strategy names.

func NewAllPermutations Uses

func NewAllPermutations(root token.Token, r rand.Rand) (chan struct{}, error)

NewAllPermutations implements a fuzzing strategy that generates all possible permutations of a token graph. Every iteration of the strategy generates a new permutation. The generation is deterministic. Since this strategy really produces every possible permutation of a token graph, it is advised to only use the strategy on graphs with few states since the state explosion problem manifests itself quite fast.

func NewAlmostAllPermutations Uses

func NewAlmostAllPermutations(root token.Token, r rand.Rand) (chan struct{}, error)

NewAlmostAllPermutations implements a fuzzing strategy that generates "almost" all possible permutations of a token graph. Every iteration of the strategy generates a new permutation. The generation is deterministic. This strategy does not cover all repititional permutations which can be helpful when less permutations are needed but a almost complete permutation coverage is still needed. For example the definition +2(?(1)?(2)) does not result in 16 permutations but instead it results in only 7.

func NewPermuteOptionals Uses

func NewPermuteOptionals(root token.Token, r rand.Rand) (chan struct{}, error)

NewPermuteOptionals implements a fuzzing strategy that generates permutations of only optional tokens of a token graph. Every iteration of the strategy generates a new permutation. The generation is deterministic. This strategy searches the graph for tokens who implement the OptionalToken interface and permutates over them by deactivating or activating them. The permutations always start from the deactivated states so that minimum data is generated first.

func NewRandom Uses

func NewRandom(root token.Token, r rand.Rand) (chan struct{}, error)

NewRandom implements a fuzzing strategy that generates a random permutation of a token graph. The strategy does exactly one iteration which permutates at random all reachable tokens in the graph. The determinism is dependent on the random generator and is therefore for example deterministic if a seed for the random generator produces always the same outputs.

func Register Uses

func Register(name string, strat Strategy)

Register registers a fuzzing strategy instance function with the given name.

type Error Uses

type Error struct {
    Message string
    Type    ErrorType
}

Error holds a fuzzing strategy error

func (*Error) Error Uses

func (err *Error) Error() string

type ErrorType Uses

type ErrorType int

ErrorType the fuzzing strategy error type

const (
    // ErrEndlessLoopDetected the token graph has a cycle which is not allowed.
    ErrEndlessLoopDetected ErrorType = iota
    // ErrNilRandomGenerator the random generator is nil
    ErrNilRandomGenerator
)

type Strategy Uses

type Strategy func(root token.Token, r rand.Rand) (chan struct{}, error)

Strategy defines a fuzzing strategy. The function starts the first iteration of the fuzzing strategy returning a channel which controls the iteration flow. The channel returns a value if the iteration is complete and waits with calculating the next iteration until a value is put in. The channel is automatically closed when there are no more iterations. The error return argument is not nil if an error occurs during the setup of the fuzzing strategy.

func New Uses

func New(name string) (Strategy, error)

New returns a new fuzzing strategy instance given the registered name of the strategy. The error return argument is not nil, if the name does not exist in the registered fuzzing strategy list.

Package strategy imports 8 packages (graph) and is imported by 1 packages. Updated 2018-11-27. Refresh now. Tools for package owners.