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: 21 Imported by: 0



Package config describes the top-level tester configuration.




This section is empty.


This section is empty.


func FilePath

func FilePath(file string, hooks ...func(string) (string, error)) (string, error)

FilePath resolves the config file path file using hooks. The first hook to successfully find a valid file wins.

func GlobalFile

func GlobalFile() (string, error)

GlobalFile gets the path to the global config file.

This usually resides in the user config directory; an error occurs if this directory is not determinable.

func StandardHooks

func StandardHooks(override string) []func(string) (string, error)

StandardHooks is the default set of hooks to use when getting a config file. These hooks are as follows: - Try the literal path override; - Try looking in the current working directory; - Try looking in the Go user config directory.


type BackendFinder

type BackendFinder struct {
	Config   *Config
	Resolver backend.Resolver

BackendFinder lets a config be used to find backends.

func (BackendFinder) FindBackend

func (c BackendFinder) FindBackend(cr backend.Criteria) (*backend.NamedSpec, error)

FindBackend uses the configuration to find a backend matching criteria cr, given resolver r.

type Config

type Config struct {
	// Backends contains information about the backends available for generating recipes.
	// These are given as a list rather than a map because ordering matters: the director will satisfy requests for
	// backends by trying each backend specification in order.
	Backends []backend.NamedSpec `toml:"backends,omitempty"`

	// RawMachines contains raw config for the machines available for testing.
	RawMachines map[string]machine.Config `toml:"machines,omitempty"`

	// Quantities gives the default quantities for the director.
	Quantities quantity.RootSet `toml:"quantities,omitempty"`

	// Fuzz contains fuzzer config overrides.
	Fuzz *fuzzer.Config `toml:"fuzz,omitempty"`

	// SSH contains top-level SSH configuration.
	SSH *remote.Config `toml:"ssh,omitempty"`

	// Paths contains path configuration for the config file.
	Paths Pathset `toml:"paths,omitempty"`

Config is a top-level tester config struct.

func Load

func Load(override string) (*Config, error)

Load tries to load a tester config from various places. If override is non-empty, it tries there. Else, it first tries the current working directory, and then tries the user config directory.

func (*Config) DisableFuzz

func (c *Config) DisableFuzz()

DisableFuzz is shorthand for setting this config's fuzzer disabled flag to false.


ExampleConfig_DisableFuzz is a runnable example for Config.DisableFuzz.

package main

import (


func main() {
	var c config.Config
	c.Fuzz.Disabled = false



func (*Config) Dump

func (c *Config) Dump(w io.Writer) error

Dump dumps this configuration to the writer w.

func (*Config) Machines

func (c *Config) Machines() (machine.ConfigMap, error)

Machines gets the checked, fully processed machine config map.

So far, this just makes sure IDs are ok.

func (*Config) OverrideInputs

func (c *Config) OverrideInputs(files []string) error

OverrideInputs is shorthand for setting this config's inputs to files, if non-empty.

func (*Config) OverrideQuantities

func (c *Config) OverrideQuantities(qs quantity.RootSet)

OverrideQuantities is shorthand for overriding the quantity set in this config.

package main

import (



func main() {
	c := config.Config{
		Quantities: quantity.RootSet{
			Plan: quantity.PlanSet{
				NWorkers: 10,
			MachineSet: quantity.MachineSet{
				Fuzz: quantity.FuzzSet{
					CorpusSize:    20,
					SubjectCycles: 4,
					NWorkers:      5,
		MachineSet: quantity.MachineSet{
			Fuzz: quantity.FuzzSet{
				SubjectCycles: 8,




type NoConfigFileError

type NoConfigFileError struct {
	// Tried is the list of config files that have been tried.
	Tried []string

NoConfigFileError wraps an error when trying to resolve a config file through FilePath.

func (*NoConfigFileError) Error

func (n *NoConfigFileError) Error() string

Error returns the error string for this error.

func (*NoConfigFileError) Unwrap

func (n *NoConfigFileError) Unwrap() error

Unwrap returns os.ErrNotExist, as this is a particular kind of not-exist error.

type Pathset

type Pathset struct {
	// OutDir is the default output path for the test director.
	OutDir string `toml:"out_dir,omitempty,omitzero"`
	// Inputs is the default set of inputs (files and/or directories) for the test director.
	Inputs []string `toml:"inputs,omitempty,omitzero"`

	// FilterFile is, if present, a path pointing to a YAML file containing analysis filter definitions.
	FilterFile string `toml:"filter_file,omitempty,omitzero"`

Pathset is a set of configuration paths (all of which are considered to be filepaths, not slashpaths).

func (Pathset) FallbackToInputs

func (p Pathset) FallbackToInputs(fs []string) ([]string, error)

FallbackToInputs returns fs if non-empty, and the homedir-expanded version of Pathset.Inputs on p otherwise.


ExamplePathset_FallbackToInputs is a runnable example for Pathset.FallbackToInputs

package main

import (


func main() {
	// Inputs can contain ~ for home expansions, but we can't easily show that in an example.
	ps := config.Pathset{Inputs: []string{"foo", "bar", "baz"}}
	is1, _ := ps.FallbackToInputs(nil)
	fmt.Println(strings.Join(is1, ", "))
	is2, _ := ps.FallbackToInputs([]string{})
	fmt.Println(strings.Join(is2, ", "))
	is3, _ := ps.FallbackToInputs([]string{"foobaz", "barbaz"})
	fmt.Println(strings.Join(is3, ", "))


foo, bar, baz
foo, bar, baz
foobaz, barbaz

func (Pathset) OutPath

func (p Pathset) OutPath(file string) (string, error)

OutPath is shorthand for getting a homedir-expanded full path for the output filename file.


ExamplePathset_OutPath is a runnable example for Pathset.OutPath.

package main

import (


func main() {
	// OutDir can contain ~ for home expansions, but we can't easily show that in an example.
	ps := config.Pathset{OutDir: filepath.Join("foo", "bar", "baz")}
	if r, err := ps.OutPath("test.yaml"); err != nil {
	} else {



func (Pathset) StatFile

func (p Pathset) StatFile() (string, error)

StatFile is shorthand for getting the statistics file path.

type ProberSet

type ProberSet struct {
	// Machine is a machine prober.
	Machine machine.Prober
	// Backend is a backend resolver used for probing.
	Backend backend.Prober
	// Compiler is a compiler prober used for probing.
	Compiler compiler.Prober

ProberSet contains the various probers used by configuration probing.

func LocalProberSet

func LocalProberSet() ProberSet

LocalProberSet provides a prober set suitable for most local probing.

func (ProberSet) Probe

func (p ProberSet) Probe(ctx context.Context, sr service.Runner, c *Config) error

Probe populates c with information found by scrutinising the current machine.


Path Synopsis
Package pretty contains pretty-printers for configuration.
Package pretty contains pretty-printers for configuration.

Jump to

Keyboard shortcuts

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