ffxutil

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 9 Imported by: 0

Documentation

Overview

Package ffxutil provides support for running ffx commands.

Index

Constants

View Source
const (

	// Test outcome values. This should match the list of values for the `outcome` field
	// of the run summary at //src/sys/run_test_suite/directory/schema/suite_summary.schema.json
	TestPassed       = "PASSED"
	TestFailed       = "FAILED"
	TestInconclusive = "INCONCLUSIVE"
	TestTimedOut     = "TIMEDOUT"
	TestError        = "ERROR"
	TestSkipped      = "SKIPPED"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CaseResult

type CaseResult struct {
	Outcome              string                      `json:"outcome"`
	Name                 string                      `json:"name"`
	StartTime            int64                       `json:"start_time"`
	DurationMilliseconds int64                       `json:"duration_milliseconds"`
	Artifacts            map[string]artifactMetadata `json:"artifacts"`
}

CaseResult is a JSON schema for a test case in structured results.

type FFXConfig

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

FFXConfig describes a config to run ffx with.

func NewIsolatedFFXConfig

func NewIsolatedFFXConfig(dir string) *FFXConfig

NewIsolatedFFXConfig creates a config that provides an isolated environment to run ffx in.

func (*FFXConfig) Close

func (c *FFXConfig) Close() error

Close removes the socket if it hasn't been removed by `ffx daemon stop`.

func (*FFXConfig) Set

func (c *FFXConfig) Set(key string, value interface{})

Set sets values in the config.

func (*FFXConfig) ToFile

func (c *FFXConfig) ToFile(configPath string) error

ToFile writes the config to a file.

type FFXInstance

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

FFXInstance takes in a path to the ffx tool and runs ffx commands with the provided config.

func NewFFXInstance

func NewFFXInstance(ffxPath string, dir string, env []string, target, sshKey string, outputDir string) (*FFXInstance, error)

NewFFXInstance creates an isolated FFXInstance.

func (*FFXInstance) GetConfig

func (f *FFXInstance) GetConfig(ctx context.Context) error

GetConfig shows the ffx config.

func (*FFXInstance) List

func (f *FFXInstance) List(ctx context.Context, args ...string) error

List lists all available targets.

func (*FFXInstance) Run

func (f *FFXInstance) Run(ctx context.Context, args ...string) error

Run runs ffx with the associated config and provided args.

func (*FFXInstance) RunWithTarget

func (f *FFXInstance) RunWithTarget(ctx context.Context, args ...string) error

RunWithTarget runs ffx with the associated target.

func (*FFXInstance) SetStdoutStderr

func (f *FFXInstance) SetStdoutStderr(stdout, stderr io.Writer)

SetStdoutStderr sets the stdout and stderr for the ffx commands to write to.

func (*FFXInstance) Snapshot

func (f *FFXInstance) Snapshot(ctx context.Context, outDir string, snapshotFilename string) error

Snapshot takes a snapshot of the target's state and saves it to outDir/snapshotFilename.

func (*FFXInstance) Stop

func (f *FFXInstance) Stop() error

Stop stops the daemon.

func (*FFXInstance) TargetWait

func (f *FFXInstance) TargetWait(ctx context.Context) error

TargetWait waits until the target becomes available.

func (*FFXInstance) Test

func (f *FFXInstance) Test(ctx context.Context, tests []TestDef, outDir string, args ...string) (*TestRunResult, error)

Test runs a test suite.

type SuiteResult

type SuiteResult struct {
	Outcome              string                      `json:"outcome"`
	Name                 string                      `json:"name"`
	Cases                []CaseResult                `json:"cases"`
	StartTime            int64                       `json:"start_time"`
	DurationMilliseconds int64                       `json:"duration_milliseconds"`
	Artifacts            map[string]artifactMetadata `json:"artifacts"`
}

SuiteResult is a JSON schema for a suite in structured results output by `ffx test run`.

type TestDef

type TestDef struct {
	TestUrl         string `json:"test_url"`
	Timeout         int    `json:"timeout,omitempty"`
	Parallel        uint16 `json:"parallel,omitempty"`
	MaxSeverityLogs string `json:"max_severity_logs,omitempty"`
}

TestDef is the JSON schema for input to `ffx test run`. Note this only contains the subset of options that are currently used.

type TestRunResult

type TestRunResult struct {
	Outcome string       `json:"outcome"`
	Suites  []suiteEntry `json:"suites"`
	// contains filtered or unexported fields
}

TestRunResult is the JSON schema for a test run in structured results output by `ffx test run`.

func (*TestRunResult) GetSuiteResults

func (r *TestRunResult) GetSuiteResults() ([]SuiteResult, error)

GetSuiteResults returns a list of the suite summaries from a test run.

func (*TestRunResult) GetTestOutputPaths

func (r *TestRunResult) GetTestOutputPaths(paths ...string) []string

GetTestOutputPaths returns the absolute paths of the given paths within the test output directory.

Jump to

Keyboard shortcuts

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