Documentation
¶
Overview ¶
Package ffxutil provides support for running ffx commands.
Index ¶
- Constants
- type CaseResult
- type FFXConfig
- type FFXInstance
- func (f *FFXInstance) GetConfig(ctx context.Context) error
- func (f *FFXInstance) List(ctx context.Context, args ...string) error
- func (f *FFXInstance) Run(ctx context.Context, args ...string) error
- func (f *FFXInstance) RunWithTarget(ctx context.Context, args ...string) error
- func (f *FFXInstance) SetStdoutStderr(stdout, stderr io.Writer)
- func (f *FFXInstance) Snapshot(ctx context.Context, outDir string, snapshotFilename string) error
- func (f *FFXInstance) Stop() error
- func (f *FFXInstance) TargetWait(ctx context.Context) error
- func (f *FFXInstance) Test(ctx context.Context, tests []TestDef, outDir string, args ...string) (*TestRunResult, error)
- type SuiteResult
- type TestDef
- type TestRunResult
Constants ¶
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 ¶
NewIsolatedFFXConfig creates a config that provides an isolated environment to run ffx in.
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 ¶
Snapshot takes a snapshot of the target's state and saves it to outDir/snapshotFilename.
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.