gomodfuzz

package
v0.1.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2019 License: MPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// Scenario.GOPATH selection modes
	EmptyGopath = iota
	UsableGopath
	UnusedGopath

	// Scenario.WD selection modes
	WdInsideGopath = iota
	WdOutsideGopath
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	// Scenario is a copy of the executed scenario spec.
	Scenario Scenario

	// Err is non-nil if the scenario's command fails to start, exits with a non-zero code,
	// or its context times out.
	//
	// It is also non-nil if `go env` fails before running the scenario's command.
	Err error

	// Code is from the scenario's command.
	//
	// It is -1 if the command does not get an opporunity to run, e.g. if `go env` fails
	// for some reason.
	Code int

	// GoEnv is the output of `go env` prior to running the scenario.
	GoEnv string

	// Stderr is from the scenario's command.
	Stderr string

	// Stdout is from the scenario's command.
	Stdout string
}

Result is the outcome of one execution of the input command in one Scenario.

func NewResult

func NewResult(s Scenario) Result

NewResult returns an initialized Result.

type Scenario

type Scenario struct {
	// GO111MODULE is the environment variable value applied to the scenario.
	//
	// It is assigned a value by a permutation generator. The generator assigns one of
	// three values: "auto", "off", "on".
	GO111MODULE string

	// GOFLAGS is the environment variable value applied to the scenario.
	//
	// It is assigned a value by a permutation generator. The generator assigns one of
	// two values: empty string or "-mod=vendor".
	GOFLAGS string

	// GOPATH is a mode of selecting environment variable value applied to the scenario.
	//
	// It is assigned a value by a permutation generator. The generator assigns one of three modes
	// which select these path types: a path which may contain the working directory as a descendant,
	// a path which never contains the working directory, and an empty string.
	GOPATH int

	// IN_MODULE is true if the command should in a working directory with a go.mod.
	//
	// It is assigned a value by a permutation generator.
	IN_MODULE bool

	// Wd is a mode of selecting the working directory in which the command runs.
	//
	// It is assigned a value by a permutation generator. The generator assigns one of
	// two modes which select these path types: "<Scenario.rootDir>/<scenario dir>/wd" or
	// "<Scenario.rootDir>/<scenario dir>/gopath/wd".
	WD int
	// contains filtered or unexported fields
}

Scenario defines how a command should be executed in a scenario.

func NewScenario

func NewScenario(executor cage_exec.Executor, rootDir string) Scenario

NewScenario returns an initialized value.

func (Scenario) BeforeRun

func (s Scenario) BeforeRun(stage *cage_file_stage.Stage) error

BeforeRun sets up the environment in preparation for Run.

func (Scenario) GetRootDir

func (s Scenario) GetRootDir() string

GetRootDir returns the top of the scenario's file tree.

func (Scenario) Gopath

func (s Scenario) Gopath() string

func (Scenario) Id

func (s Scenario) Id() int

func (*Scenario) PermuteAxes

func (s *Scenario) PermuteAxes() (axes []interface{})

PermuteAxes enumerates all the fields whose possible values should yield permutations, e.g. "size" and "color".

It implements Permutator.

func (Scenario) PermuteId

func (s Scenario) PermuteId(subject interface{}, id int) interface{}

PermuteId stores the permutation ID.

It implements Permutator.

func (*Scenario) PermuteNew

func (s *Scenario) PermuteNew(subject, axis, value interface{}) interface{}

PermuteNew returns a new permutation with the input axis assigned the input value.

It implements Permutator.

func (*Scenario) PermuteSubject

func (s *Scenario) PermuteSubject() interface{}

PermuteSubject returns a zero-valued subject from which permutations are created.

It implements Permutator.

func (*Scenario) PermuteValues

func (s *Scenario) PermuteValues(axis interface{}) (values []interface{})

PermuteValues returns all possible values of the input axis, e.g. "red" and "green" for axis "colors".

It implements Permutator.

func (Scenario) Run

func (s Scenario) Run(ctx context.Context, args []string) (res Result, err error)

Run applies the permutation-defined fields, runs the command, and returns the result.

func (Scenario) String

func (s Scenario) String() string

String returns a scenario identifier for display.

func (Scenario) UsableGopath

func (s Scenario) UsableGopath() string

func (Scenario) Wd

func (s Scenario) Wd() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL