Documentation ¶
Overview ¶
Package runner implements sandboxed Go benchmark execution.
Index ¶
- func HostSnapshotBuilderType() (string, bool)
- func SnapshotBuilderType(goos, goarch string) (string, bool)
- func ToolchainConfigurationProvider(tc Toolchain) cfg.Provider
- type Option
- type Runner
- func (r *Runner) AddConfigurationProvider(p cfg.Provider)
- func (r *Runner) Benchmark(ctx context.Context, s job.Suite, output string)
- func (r *Runner) Clean(ctx context.Context)
- func (r *Runner) Go(ctx context.Context, arg ...string) *exec.Cmd
- func (r *Runner) GoExec(ctx context.Context, arg ...string)
- func (r *Runner) Init(ctx context.Context)
- func (r *Runner) SetGoProxy(proxy string)
- func (r *Runner) Tune(t Tuner)
- func (r *Runner) Wrap(w ...Wrapper)
- type Toolchain
- type Tuner
- type Workspace
- func (w *Workspace) AddEnviron(env ...string)
- func (w *Workspace) AppendPATH(path string)
- func (w *Workspace) Artifact(path, name string)
- func (w *Workspace) Cd(path string)
- func (w *Workspace) CdRoot()
- func (w *Workspace) Clean()
- func (w *Workspace) DefineTool(key, dflt string)
- func (w *Workspace) Download(url, path string)
- func (w *Workspace) EnsureDir(rel string) string
- func (w *Workspace) Error() error
- func (w *Workspace) Exec(cmd *exec.Cmd)
- func (w *Workspace) ExposeTool(name string)
- func (w *Workspace) GetEnv(key string) string
- func (w *Workspace) InheritEnv(key string)
- func (w *Workspace) Move(src, dst string)
- func (w *Workspace) Options(opts ...Option)
- func (w *Workspace) Path(rel string) string
- func (w *Workspace) Sandbox(task string) string
- func (w *Workspace) SetEnv(key, value string)
- func (w *Workspace) SetEnvDefault(key, value string) string
- func (w *Workspace) Uncompress(src, dst string)
- type Wrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostSnapshotBuilderType ¶
HostSnapshotBuilderType gives looks for a builder type for host platform.
func SnapshotBuilderType ¶
SnapshotBuilderType looks for a suitable builder type to download snapshots for the given GOOS/GOARCH.
func ToolchainConfigurationProvider ¶
ToolchainConfigurationProvider provides benchmark configuration lines about the given toolchain.
Types ¶
type Option ¶
type Option func(*Workspace)
func InheritEnviron ¶
func InheritEnviron() Option
func WithArtifactStore ¶
func WithEnviron ¶
func WithHTTPClient ¶
func WithLogger ¶
func WithWorkDir ¶
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
func (*Runner) AddConfigurationProvider ¶
AddConfigurationProvider adds a configuration provider that will be applied to every benchmark run.
func (*Runner) SetGoProxy ¶
SetGoProxy sets the GOPROXY environment variable.
type Toolchain ¶
type Toolchain interface { // Type identifier. Type() string // String gives a concise identifier for the toolchain. String() string // Ref is a git reference to the Go repository version (sha or tag). Ref() string // Configuration returns configuration lines for the Configuration() (cfg.Configuration, error) // Install the toolchain to the given location in the workspace. Install(w *Workspace, root string) }
func NewRelease ¶
NewRelease constructs a release toolchain for the given version, os and architecture. Version is expected to begin with "go", for example "go1.13.4".
func NewSnapshot ¶
type Tuner ¶
type Tuner interface { // Name identifies the tuning method. Name() string // Available checks whether the method can be applied at all. Note this is // intended to be a basic environment check, it is still possible that // Apply() could fail if Available() returns true. Available() bool // Apply the tuning method. Apply() error // Reset state to default configuration. Reset() error }
Tuner tunes a system for benchmarking.
type Workspace ¶
func NewWorkspace ¶
func (*Workspace) AddEnviron ¶
AddEnviron is a convenience for setting multiple environment variables given a list of "KEY=value" strings. Provided for easy interoperability with functions like os.Environ().
func (*Workspace) AppendPATH ¶
AppendPATH appends a directory to the PATH variable, if it is not already present.
func (*Workspace) CdRoot ¶
func (w *Workspace) CdRoot()
CdRoot sets the working directory to the root of the workspace.
func (*Workspace) DefineTool ¶
DefineTool defines a standard tool with environment variable key and default dflt, for example "CC" with default "gcc". If the environment variable is set in the host environment, it is inherited, otherwise it is set to the default and the PATH is edited to ensure it is accessible within the workspace.
func (*Workspace) ExposeTool ¶
ExposeTool makes the named tool available to the workspace by looking up its location and adding the directory to the PATH.
func (*Workspace) InheritEnv ¶
InheritEnv sets the environment variable key to the same as the surrounding environment, if it is defined. Otherwise does nothing.
func (*Workspace) Sandbox ¶
Sandbox creates a fresh temporary directory, sets it as the working directory and returns it.
func (*Workspace) SetEnvDefault ¶
SetEnvDefault sets an environment variable if it does not already have a value.
func (*Workspace) Uncompress ¶
Uncompress archive src to the directory dst.