runner

package
v0.0.0-...-1dd1f65 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package runner contains the part of c4t that runs compiled test binaries and interprets their output.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoBin occurs when a successful compile result	has no binary path attached.
	ErrNoBin = errors.New("no binary in compile result")

	// ErrParserNil occurs when a runner config doesn't specify an observation parser.
	ErrParserNil = errors.New("obs-parser nil")
)

Functions

This section is empty.

Types

type CompilerResult

type CompilerResult struct {
	// Status is the status of this run.
	Status status.Status `json:"status"`

	// Obs is this subject's processed observation, if any.
	Obs *obs.Obs `json:"obs,omitempty"`
}

CompilerResult contains results from a subject/compiler pairing.

type Error

type Error struct {
	// Stage is a representation of the part of the runner that went wrong.
	Stage string

	// Compilation is the name of the compilation whose run caused the error.
	Compilation compilation.Name

	// Inner is the inner error, if any, that caused this error.
	Inner error
}

Error is the main error type returned by the runner. It wraps an inner error with various pieces of context.

func (Error) Error

func (e Error) Error() string

Error implements the error protocol for Error.

func (Error) Unwrap

func (e Error) Unwrap() error

Unwrap unwraps an Error, returning its inner error.

type Instance

type Instance struct {
	// contains filtered or unexported fields
}

Instance contains all state required to perform a runner operation for a given subject.

func (*Instance) Run

func (n *Instance) Run(ctx context.Context) error

Run runs the instance with context ctx.

type Option

type Option func(*Runner) error

Option is the type of functional options for the machine node.

func ObserveWith

func ObserveWith(obs ...observer.Observer) Option

ObserveWith adds each observer in obs to the runner's observer list.

func Options

func Options(opts ...Option) Option

Options applies each option in opts in turn.

func OverrideQuantities

func OverrideQuantities(qs quantity.BatchSet) Option

OverrideQuantities overrides this runner's quantities with qs.

type Pathset

type Pathset struct {
	// DirObs is the directory into which observations should go.
	DirObs string

	// DirFailures is the directory into which failing tests should go.
	DirFailures string
}

Pathset contains the top-level paths for a runner instance.

func NewPathset

func NewPathset(root string) *Pathset

NewPathset constructs a new pathset from the directory root.

type Result

type Result struct {
	// Time is the time at which the run commenced.
	Time time.Time `json:"time,omitempty"`

	// Normalise is the set of results categorised by subject.
	// Each key is the subject's name.
	Subjects map[string]SubjectResult `json:"subject,omitempty"`
}

Result is the type of results from a single test run.

type Runner

type Runner struct {
	// contains filtered or unexported fields
}

Runner contains information necessary to run a plan's compiled test cases.

func New

func New(resolver backend.Resolver, paths *Pathset, opts ...Option) (*Runner, error)

New creates a new batch compiler instance using the config c and plan p. It can fail if various safety checks fail on the config, or if there is no obvious machine that the compiler can target.

func (*Runner) Close

func (*Runner) Close() error

Close does nothing.

func (*Runner) Run

func (r *Runner) Run(ctx context.Context, p *plan.Plan) (*plan.Plan, error)

Run runs the runner on the plan p.

func (*Runner) Stage

func (*Runner) Stage() stage.Stage

Stage gets the appropriate stage record for the runner.

type SubjectResult

type SubjectResult struct {
	// Compilers is the set of per-compiler results that were reported for this subject.
	// Each key is a stringified form of a compiler CompilerID.
	Compilers map[string]CompilerResult `json:"compiler,omitempty"`
}

SubjectResult contains results from a single subject.

Jump to

Keyboard shortcuts

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