runnerclient

package
v0.0.0-...-15a9a0c Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package runnerclient provides a client interface to tast test runners.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is a GRPC-protocol client to test_runner.

func New

func New(cmd genericexec.Cmd, params *protocol.RunnerInitParams, msgTimeout time.Duration, hops int) *Client

New creates a new Client.

func (*Client) CollectSysInfo

func (c *Client) CollectSysInfo(ctx context.Context, req *protocol.CollectSysInfoRequest) (res *protocol.CollectSysInfoResponse, retErr error)

CollectSysInfo collects the sysinfo, considering diff from the given initial sysinfo state.

func (*Client) DownloadPrivateBundles

func (c *Client) DownloadPrivateBundles(ctx context.Context, req *protocol.DownloadPrivateBundlesRequest) (retErr error)

DownloadPrivateBundles downloads and installs a private test bundle archive corresponding to the target version, if one has not been installed yet.

func (*Client) GetDUTInfo

func (c *Client) GetDUTInfo(ctx context.Context, req *protocol.GetDUTInfoRequest) (res *protocol.GetDUTInfoResponse, retErr error)

GetDUTInfo retrieves various DUT information needed for test execution.

func (*Client) GetSysInfoState

func (c *Client) GetSysInfoState(ctx context.Context, req *protocol.GetSysInfoStateRequest) (res *protocol.GetSysInfoStateResponse, retErr error)

GetSysInfoState collects the sysinfo state of the DUT.

func (*Client) GlobalRuntimeVars

func (c *Client) GlobalRuntimeVars(ctx context.Context) (vars []string, retErr error)

GlobalRuntimeVars client implementation

func (*Client) ListFixtures

func (c *Client) ListFixtures(ctx context.Context) (fixtures []*drivercore.BundleEntity, retErr error)

ListFixtures enumerates all fixtures.

func (*Client) ListTests

func (c *Client) ListTests(ctx context.Context, patterns []string, features *protocol.Features) (tests []*drivercore.BundleEntity, retErr error)

ListTests enumerates tests matching patterns.

func (*Client) RunTests

func (c *Client) RunTests(ctx context.Context, bcfg *protocol.BundleConfig, rcfg *protocol.RunConfig, out RunTestsOutput)

RunTests requests to run tests according to the given RunConfig. Test execution events are streamed back via out. See RunTestsOutput for details.

func (*Client) StreamFile

func (c *Client) StreamFile(ctx context.Context, src, dest string, offset int64) (nextOffset int64, err error)

StreamFile stream a file from the source file at target DUT to a destination file at the host.

type RunTestsOutput

type RunTestsOutput interface {
	// RunStart is called exactly once at the beginning of an overall test
	// execution.
	RunStart(ctx context.Context) error

	EntityStart(ctx context.Context, ev *protocol.EntityStartEvent) error
	EntityLog(ctx context.Context, ev *protocol.EntityLogEvent) error
	EntityError(ctx context.Context, ev *protocol.EntityErrorEvent) error
	EntityEnd(ctx context.Context, ev *protocol.EntityEndEvent) error
	RunLog(ctx context.Context, ev *protocol.RunLogEvent) error

	// RunEnd is called exactly once at the end of an overall test execution.
	// If any other method returns a non-nil error, test execution is aborted
	// immediately and RunEnd is called with the error.
	RunEnd(ctx context.Context, err error)
}

RunTestsOutput is implemented by callers of RunTests to receive test execution events.

Its methods (except RunStart and RunEnd) are called on receiving a corresponding test execution event. In case of errors, they can be called in an inconsistent way (e.g. EntityEnd is not called after EntityStart due to a test crash). RunTestsOutput implementations must be prepared to handle such error cases correctly.

All methods except RunEnd can return an error, which leads to immediate abort of the test execution and subsequent RunEnd call.

Jump to

Keyboard shortcuts

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