metaflags

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package metaflags defines command-line flags for the metamorphic tests and provides functionality to construct the respective metamorphic.RunOptions/RunOnceOptions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitAllFlags

func InitAllFlags() (*RunOnceFlags, *RunFlags)

InitAllFlags initializes all metamorphic test flags: those used for a single run, and those used for a "top level" run.

Types

type CommonFlags

type CommonFlags struct {
	// Dir is the directory storing test state. See "dir" flag below.
	Dir string
	// Seed for generation of random operations. See "seed" flag below.
	Seed uint64
	// ErrorRate is the rate of injected filesystem errors. See "error-rate" flag
	// below.
	ErrorRate float64
	// FailRE causes the test to fail if the output matches this regex. See "fail"
	// flag below.
	FailRE string
	// Keep determines if the DB directory is kept on successful runs. See "keep"
	// flag below.
	Keep bool
	// MaxThreads used by a single run. See "max-threads" flag below.
	MaxThreads int
}

CommonFlags contains flags that apply to both metamorphic.Run and metamorphic.RunOnce/Compare.

type RunFlags

type RunFlags struct {
	*CommonFlags
	// FS controls the type of filesystems to use. See "fs" flag below.
	FS string
	// TraceFile for execution tracing. See "trace-file" flag below.
	TraceFile string
	// Ops describes how the total number of operations is generated. See "ops" flags below.
	Ops randvar.Flag
	// InnerBinary is the binary to invoke for a single run. See "inner-binary"
	// flag below.
	InnerBinary string
	// PreviousOps is the path to the ops file of a previous run. See the
	// "previous-ops" flag below.
	PreviousOps string
	// InitialStatePath is the path to a database data directory from a previous
	// run. See the "initial-state" flag below.
	InitialStatePath string
	// InitialStateDesc is a human-readable description of the initial database
	// state. See "initial-state-desc" flag below.
	InitialStateDesc string
}

RunFlags contains flags that apply only to metamorphic.Run.

func (*RunFlags) MakeRunOptions

func (r *RunFlags) MakeRunOptions() []metamorphic.RunOption

MakeRunOptions constructs RunOptions based on the flags.

type RunOnceFlags

type RunOnceFlags struct {
	*CommonFlags
	// RunDir applies to metamorphic.RunOnce and contains the specific
	// configuration of the run. See "run-dir" flag below.
	RunDir string
	// Compare applies to metamorphic.Compare. See "compare" flag below.
	Compare string
}

RunOnceFlags contains flags that apply only to metamorphic.RunOnce/Compare.

func InitRunOnceFlags

func InitRunOnceFlags() *RunOnceFlags

InitRunOnceFlags initializes the flags that are used for a single run of the metamorphic test.

func (*RunOnceFlags) MakeRunOnceOptions

func (ro *RunOnceFlags) MakeRunOnceOptions() []metamorphic.RunOnceOption

MakeRunOnceOptions constructs RunOnceOptions based on the flags.

Jump to

Keyboard shortcuts

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