driver

package
v0.0.0-...-b5d9cbe Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: BSD-3-Clause Imports: 30 Imported by: 0

Documentation

Overview

Package driver implements communications with local/remote executables related to Tast.

Index

Constants

View Source
const (
	// SystemLogsDir is a result subdirectory where system logs are saved
	// by CollectSysInfo.
	SystemLogsDir = "system_logs"

	// CrashesDir is a result subdirectory where crash dumps are saved by
	// CollectSysInfo.
	CrashesDir = "crashes"
)
View Source
const (
	// SSHPingTimeout is the timeout for checking if SSH connection to DUT is open.
	SSHPingTimeout = target.SSHPingTimeout
)
View Source
const TestRecursively = "TAST_TEST_RECURSIVELY"

TestRecursively is environment variable key which is set to "0" to disable recursive test running flow and support full remote fixtures. TODO(b/187957164): Remove this after migration has finished.

Variables

This section is empty.

Functions

func ShouldRunTestsRecursively

func ShouldRunTestsRecursively() bool

ShouldRunTestsRecursively indicates if Tast tests should be run recursively (i.e. remote bundle invokes local bundle).

Types

type BundleEntity

type BundleEntity = drivercore.BundleEntity

BundleEntity is a pair of a ResolvedEntity and its bundle name.

type Driver

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

Driver implements communications with local/remote executables related to Tast.

Driver maintains a connection to the target device. Getter methods related to a current connection are guaranteed to return immediately. Other methods may re-establish a connection to the target device, so you should get a fresh connection object after calling them.

func New

func New(ctx context.Context, cfg *config.Config, rawTarget, role string) (*Driver, error)

New establishes a new connection to the target device and returns a Driver.

func (*Driver) Close

func (d *Driver) Close(ctx context.Context) error

Close closes the current connection to the target device.

func (*Driver) CollectSysInfo

func (d *Driver) CollectSysInfo(ctx context.Context, initialSysInfo *protocol.SysInfoState) (retErr error)

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

func (*Driver) ConnCacheForTesting

func (d *Driver) ConnCacheForTesting() *target.ConnCache

ConnCacheForTesting returns target.ConnCache the driver owns for testing.

func (*Driver) ConnectionSpec

func (d *Driver) ConnectionSpec() string

ConnectionSpec returns a connection spec as [<user>@]host[:<port>].

func (*Driver) DefaultTimeout

func (d *Driver) DefaultTimeout() time.Duration

DefaultTimeout returns the default timeout for connection operations.

func (*Driver) DownloadPrivateBundles

func (d *Driver) DownloadPrivateBundles(ctx context.Context, dutInfo *protocol.DUTInfo) error

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

func (*Driver) Duplicate

func (d *Driver) Duplicate(ctx context.Context) (*Driver, error)

Duplicate duplicate a driver.

func (*Driver) GetDUTInfo

func (d *Driver) GetDUTInfo(ctx context.Context) (*protocol.DUTInfo, error)

GetDUTInfo retrieves various DUT information needed for test execution.

func (*Driver) GetSysInfoState

func (d *Driver) GetSysInfoState(ctx context.Context) (*protocol.SysInfoState, error)

GetSysInfoState collects the sysinfo state of the DUT.

func (*Driver) GlobalRuntimeVars

func (d *Driver) GlobalRuntimeVars(ctx context.Context) ([]string, error)

GlobalRuntimeVars in driver class append result between local and remote.

func (*Driver) InitBootID

func (d *Driver) InitBootID() string

InitBootID returns a boot ID string obtained on the first successful connection to the target device.

func (*Driver) ListLocalFixtures

func (d *Driver) ListLocalFixtures(ctx context.Context) ([]*BundleEntity, error)

ListLocalFixtures enumerates all local fixtures.

func (*Driver) ListMatchedLocalTests

func (d *Driver) ListMatchedLocalTests(ctx context.Context, features *protocol.Features) ([]*BundleEntity, error)

ListMatchedLocalTests enumerates local tests matched with the user-supplied patterns.

func (*Driver) ListMatchedTests

func (d *Driver) ListMatchedTests(ctx context.Context, features *protocol.Features) ([]*BundleEntity, error)

ListMatchedTests enumerates tests matched with the user-supplied patterns.

func (*Driver) ListRemoteFixtures

func (d *Driver) ListRemoteFixtures(ctx context.Context) ([]*BundleEntity, error)

ListRemoteFixtures enumerates all remote fixtures.

func (*Driver) ProxyCommand

func (d *Driver) ProxyCommand() string

ProxyCommand returns the proxy command.

func (*Driver) ReconnectIfNeeded

func (d *Driver) ReconnectIfNeeded(ctx context.Context, rebootBeforeReconnect bool) error

ReconnectIfNeeded ensures that the current connection is healthy, and otherwise it re-establishes a connection.

func (*Driver) RunTests

func (d *Driver) RunTests(ctx context.Context,
	tests []*BundleEntity,
	dutInfos map[string]*protocol.DUTInfo,
	client *reporting.RPCClient,
	remoteDevservers []string) ([]*resultsjson.Result, error)

RunTests runs specified tests per bundle.

func (*Driver) SSHConn

func (d *Driver) SSHConn() *ssh.Conn

SSHConn returns ssh.Conn for the current connection. The return value may change after calling non-getter methods.

func (*Driver) Services

func (d *Driver) Services() *Services

Services returns a Services object that owns various services exposed to the target device. The return value may change after calling non-getter methods.

func (*Driver) StreamFile

func (d *Driver) StreamFile(ctx context.Context, src, dest string) error

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

type Services

type Services = target.Services

Services owns services exposed to a target device by SSH port forwarding.

Directories

Path Synopsis
internal
drivercore
Package drivercore defines core data types for the driver package.
Package drivercore defines core data types for the driver package.
runnerclient
Package runnerclient provides a client interface to tast test runners.
Package runnerclient provides a client interface to tast test runners.
sshconfig
Package sshconfig provides functionality to parse SSH configuration and return real host information to users.
Package sshconfig provides functionality to parse SSH configuration and return real host information to users.

Jump to

Keyboard shortcuts

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