Version: v0.0.0-...-0d16973 Latest Latest

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

Go to latest
Published: Aug 10, 2021 License: MIT Imports: 17 Imported by: 0



Package planner contains the logic for the test planner.



This section is empty.


View Source
var (
	ErrBProbeNil = errors.New("backend finder nil")
	ErrSProbeNil = errors.New("subject prober nil")


func ExpandLitmusInputs

func ExpandLitmusInputs(in []string) ([]string, error)

ExpandLitmusInputs expands a list of possible Litmus files or containing directories into a flat file list.

func OnPlan

func OnPlan(m Message, obs ...Observer)

OnPlan sends a plan message m to each observer in obs.


type CompilerLister

type CompilerLister interface {
	// Compilers asks the compiler inspector to list all available compilers.
	Compilers() (map[id.ID]compiler.Compiler, error)

CompilerLister is the interface of things that can query compiler information for a particular machine.

type CompilerPlanner

type CompilerPlanner struct {
	// Lister lists the available compilers.
	Lister CompilerLister
	// Filter is the filtering glob to use on compiler names.
	Filter id.ID
	// Observers contains observers for the CompilerPlanner.
	Observers []compiler.Observer

CompilerPlanner contains the state necessary to make up the compiler part of a test plan.

func (*CompilerPlanner) Plan

Plan constructs the compiler set for a plan.

type CorpusPlanner

type CorpusPlanner struct {
	// Files contains the files that are to be included in the plan.
	Files []string
	// Observers observe the process of building the corpus.
	Observers []builder.Observer
	// Prober tells the planner how to probe corpus files for specific information.
	Prober SubjectProber
	// Quantities contains the target size and worker count of the corpus.
	Quantities quantity.PlanSet

CorpusPlanner contains the state required to plan the corpus part of an initial plan file.

func (*CorpusPlanner) Plan

func (p *CorpusPlanner) Plan(ctx context.Context) (corpus.Corpus, error)

Plan probes each subject in this planner's corpus file list, producing a Corpus proper. It does not sample; sampling is left to the perturb stage.

type Kind

type Kind uint8

Kind is the enumeration of kinds of planner message.

const (
	// KindStart means that the planner is starting.
	// Quantities points to the planner's quantity set.
	KindStart Kind = iota
	// KindPlanningBackend means that the planner is now getting information about the backend to use.
	// KindPlanningCorpus means that the planner is now getting information about the corpus.
	// The corpus will be announced as a series of OnBuild messages.
	// KindPlanningCompilers means that the planner is now getting information about the compilers for a given machine.
	// MachineID points to the name of the machine.
	// The selected compilers will be announced as a series of OnCompilerConfig messages.

type Message

type Message struct {
	// Kind is the kind of message being sent.
	Kind Kind

	// Quantities points to the quantity set on start messages.
	Quantities *quantity.PlanSet

	// MachineID contains the machine identifier in certain messages.
	MachineID id.ID

Message is the type of messages sent through OnPlan.

type Observer

type Observer interface {

	// OnPlan is sent when the planner is doing something new.
	OnPlan(m Message)

Observer is the type of observers for the planner.

type Option

type Option func(*Planner) error

Option is the type of options to the Planner constructor.

func FilterCompilers

func FilterCompilers(filter string) Option

FilterCompilers sets the glob used for filtering compilers.

func ObserveWith

func ObserveWith(obs ...Observer) Option

ObserveWith adds each observer in obs to the observer pool.

func Options

func Options(opts ...Option) Option

Options applies each option in opts in turn.

func OverrideQuantities

func OverrideQuantities(qs quantity.PlanSet) Option

OverrideQuantities overrides this planner's quantities with qs.

type Planner

type Planner struct {
	// contains filtered or unexported fields

Planner holds all configuration for the test planner.

func New

func New(src Source, opts ...Option) (*Planner, error)

New constructs a new planner with the given source and options.

func (*Planner) Plan

func (p *Planner) Plan(ctx context.Context, ms machine.ConfigMap, fs ...string) (plan.Map, error)

Plan runs the test planner on the given fileset fs and config ms. It returns, on success, a map from machine IDs to their test plans.

type Source

type Source struct {
	// BProbe is the backend finder.
	BProbe backend2.Finder

	// SProbe is the subject prober.
	SProbe SubjectProber

Source contains all of the various sources for a Planner's information.

func (*Source) Check

func (s *Source) Check() error

Check makes sure that all of this source's components are present and accounted for.

type SubjectProber

type SubjectProber interface {
	// ProbeSubject probes the Litmus test at filepath litmus, producing a named subject record.
	ProbeSubject(ctx context.Context, litmus string) (*subject.Named, error)

SubjectProber is the interface of types that allow filling in of subject information.


Path Synopsis

Jump to

Keyboard shortcuts

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