config

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: 19 Imported by: 0

Documentation

Overview

Package config defines common structs to carry configuration and associated stateful data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ShouldConnect

func ShouldConnect(target string) bool

ShouldConnect tells whether we should connect to the specified target.

Types

type Config

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

Config contains shared configuration information for running or listing tests. All Config values are frozen and cannot be altered after construction.

func (*Config) Build

func (c *Config) Build() bool

Build is rebuild (and push, for local tests) a single test bundle.

func (*Config) BuildArtifactsURLOverride

func (c *Config) BuildArtifactsURLOverride() string

BuildArtifactsURLOverride is Google Cloud Storage URL of build artifacts specified in the command line. If it is empty, it should be detected from the DUT.

func (*Config) BuildBucketID

func (c *Config) BuildBucketID() string

BuildBucketID specifies the build bucket ID of the scheduled job that run Tast tests.

func (*Config) BuildBundle

func (c *Config) BuildBundle() string

BuildBundle is name of the test bundle to rebuild (e.g. "cros").

func (*Config) BuildCfg

func (c *Config) BuildCfg() *build.Config

BuildCfg returns a build.Config.

func (*Config) BuildOutDir

func (c *Config) BuildOutDir() string

BuildOutDir is path to base directory under which executables are stored.

func (*Config) BuildWorkspace

func (c *Config) BuildWorkspace() string

BuildWorkspace is path to workspace containing test bundle source code.

func (*Config) BundleWorkspaces

func (c *Config) BundleWorkspaces() []string

BundleWorkspaces returns Go workspaces containing source code needed to build c.BuildBundle.

func (*Config) CheckPortageDeps

func (c *Config) CheckPortageDeps() bool

CheckPortageDeps is check whether test bundle's dependencies are installed before building.

func (*Config) CheckTestDeps

func (c *Config) CheckTestDeps() bool

CheckTestDeps is whether test dependencies should be checked.

func (*Config) CollectSysInfo

func (c *Config) CollectSysInfo() bool

CollectSysInfo is collect system info (logs, crashes, etc.) generated during testing.

func (*Config) CommonWorkspaces

func (c *Config) CommonWorkspaces() []string

CommonWorkspaces returns Go workspaces containing source code needed to build all Tast-related executables.

func (*Config) CompanionDUTs

func (c *Config) CompanionDUTs() map[string]string

CompanionDUTs is role to address mapping of companion DUTs..

func (*Config) ContinueAfterFailure

func (c *Config) ContinueAfterFailure() bool

ContinueAfterFailure is try to run remaining local tests after bundle/DUT crash or lost SSH connection.

func (*Config) DUTLabConfig

func (c *Config) DUTLabConfig() *frameworkprotocol.DUTLabConfig

DUTLabConfig specifies the DUT lab configuration of the DUTs used for the running Tast.

func (*Config) DebuggerPortForwarding

func (c *Config) DebuggerPortForwarding() bool

DebuggerPortForwarding is whether port forwarding should be performed for you when debugging.

func (*Config) DebuggerPorts

func (c *Config) DebuggerPorts() map[debugger.DebugTarget]int

DebuggerPorts is a mapping from binary to the port we want to debug said binary on.

func (*Config) DefaultVarsDirs

func (c *Config) DefaultVarsDirs() []string

DefaultVarsDirs is dirs containing default variable files.

func (*Config) Devservers

func (c *Config) Devservers() []string

Devservers is list of devserver URLs; set by -devservers but may be dynamically modified.

func (*Config) DownloadMode

func (c *Config) DownloadMode() protocol.DownloadMode

DownloadMode is strategy to download external data files.

func (*Config) DownloadPrivateBundles

func (c *Config) DownloadPrivateBundles() bool

DownloadPrivateBundles is whether to download private bundles if missing.

func (*Config) ExcludeSkipped

func (c *Config) ExcludeSkipped() bool

ExcludeSkipped is whether tests which would be skipped are excluded.

func (*Config) ExtraAllowedBuckets

func (c *Config) ExtraAllowedBuckets() []string

ExtraAllowedBuckets is extra Google Cloud Storage buckets ephemeral devserver is allowed to access.

func (*Config) ExtraUSEFlags

func (c *Config) ExtraUSEFlags() []string

ExtraUSEFlags is additional USE flags to inject when determining features.

func (*Config) Features

Features constructs Features from Config and protocol.DUTFeatures.

func (*Config) ForceSkips

func (c *Config) ForceSkips() map[string]*protocol.ForceSkip

ForceSkips returns the mapping between name of disabled tests and the reason of disabling the test.

func (*Config) InstallPortageDeps

func (c *Config) InstallPortageDeps() bool

InstallPortageDeps is install old or missing test bundle dependencies; no-op if CheckPortageDeps is false.

func (*Config) KeyDir

func (c *Config) KeyDir() string

KeyDir is a directory containing private SSH keys (typically $HOME/.ssh).

func (*Config) KeyFile

func (c *Config) KeyFile() string

KeyFile is the path to a private SSH key to use to connect to the target device.

func (*Config) LocalBundleDir

func (c *Config) LocalBundleDir() string

LocalBundleDir is dir where packaged local test bundles are installed.

func (*Config) LocalBundleGlob

func (c *Config) LocalBundleGlob() string

LocalBundleGlob returns a file path glob that matches local test bundle executables.

func (*Config) LocalDataDir

func (c *Config) LocalDataDir() string

LocalDataDir is dir containing packaged local test data.

func (*Config) LocalOutDir

func (c *Config) LocalOutDir() string

LocalOutDir is dir where intermediate outputs of local tests are written.

func (*Config) LocalRunner

func (c *Config) LocalRunner() string

LocalRunner is path to executable that runs local test bundles.

func (*Config) LocalTempDir

func (c *Config) LocalTempDir() string

LocalTempDir is dir where temporary files of local tests are written.

func (*Config) MaxSysMsgLogSize

func (c *Config) MaxSysMsgLogSize() int64

MaxSysMsgLogSize is size for truncate log files.

func (*Config) MaxTestFailures

func (c *Config) MaxTestFailures() int

MaxTestFailures is maximum number of test failures.

func (*Config) MaybeMissingVars

func (c *Config) MaybeMissingVars() string

MaybeMissingVars is regex matching with variables which may be missing.

func (*Config) Mode

func (c *Config) Mode() Mode

Mode is action to perform.

func (*Config) MsgTimeout

func (c *Config) MsgTimeout() time.Duration

MsgTimeout is timeout for reading control messages; default used if zero.

func (*Config) Patterns

func (c *Config) Patterns() []string

Patterns specifies the patterns of tests to operate against.

func (*Config) PrimaryBundle

func (c *Config) PrimaryBundle() string

PrimaryBundle is the name of the primary bundle that remote fixtures are linked to.

func (*Config) ProtoSSHConfig

func (c *Config) ProtoSSHConfig() *protocol.SSHConfig

ProtoSSHConfig returns an SSHConfig proto.

func (*Config) Proxy

func (c *Config) Proxy() ProxyMode

Proxy is how proxies should be used.

func (*Config) ProxyCommand

func (c *Config) ProxyCommand() string

ProxyCommand specifies the command to use to connect to the DUT.

func (*Config) RemoteBundleDir

func (c *Config) RemoteBundleDir() string

RemoteBundleDir is dir where packaged remote test bundles are installed.

func (*Config) RemoteBundleGlob

func (c *Config) RemoteBundleGlob() string

RemoteBundleGlob returns a file path glob that matches remote test bundle executables.

func (*Config) RemoteDataDir

func (c *Config) RemoteDataDir() string

RemoteDataDir is dir containing packaged remote test data.

func (*Config) RemoteOutDir

func (c *Config) RemoteOutDir() string

RemoteOutDir is dir where intermediate outputs of remote tests are written.

func (*Config) RemoteRunner

func (c *Config) RemoteRunner() string

RemoteRunner is path to executable that runs remote test bundles.

func (*Config) RemoteTempDir

func (c *Config) RemoteTempDir() string

RemoteTempDir is dir where temporary files of remote tests are written.

func (*Config) ReportsServer

func (c *Config) ReportsServer() string

ReportsServer is address of Reports server if available.

func (*Config) ResDir

func (c *Config) ResDir() string

ResDir is the path to the directory where test results should be written. It is only used for RunTestsMode.

func (*Config) Retries

func (c *Config) Retries() int

Retries is the number of retries for failing tests

func (*Config) SSHRetries

func (c *Config) SSHRetries() int

SSHRetries is number of SSH connect retries.

func (*Config) ShardIndex

func (c *Config) ShardIndex() int

ShardIndex specifies the index of shard to used in the current run.

func (*Config) ShardMethod

func (c *Config) ShardMethod() string

ShardMethod specifies which sharding method we should use.

func (*Config) SwarmingTaskID

func (c *Config) SwarmingTaskID() string

SwarmingTaskID specifies the swarming task ID of the scheduled job that run Tast tests.

func (*Config) SystemServicesTimeout

func (c *Config) SystemServicesTimeout() time.Duration

SystemServicesTimeout for waiting for system services to be ready in seconds. (Default: 120 seconds)

func (*Config) TLWServer

func (c *Config) TLWServer() string

TLWServer is address of the TLW server if available.

func (*Config) Target

func (c *Config) Target() string

Target is the target device for testing, in the form "[<user>@]host[:<port>]".

func (*Config) TastDir

func (c *Config) TastDir() string

TastDir is base directory under which files are written.

func (*Config) TestVars

func (c *Config) TestVars() map[string]string

TestVars is names and values of variables used to pass out-of-band data to tests.

func (*Config) TotalShards

func (c *Config) TotalShards() int

TotalShards is total number of shards to be used in a test run.

func (*Config) TrunkDir

func (c *Config) TrunkDir() string

TrunkDir is path to ChromeOS checkout.

func (*Config) UseEphemeralDevserver

func (c *Config) UseEphemeralDevserver() bool

UseEphemeralDevserver is start an ephemeral devserver if no devserver is specified.

func (*Config) VarsFiles

func (c *Config) VarsFiles() []string

VarsFiles is paths to variable files.

func (*Config) WaitUntilReady

func (c *Config) WaitUntilReady() bool

WaitUntilReady is whether to wait for DUT to be ready before running tests.

func (*Config) WaitUntilReadyTimeout

func (c *Config) WaitUntilReadyTimeout() time.Duration

WaitUntilReadyTimeout set a timeout for the entire ready.Wait function. (Default: 120 seconds)

type DeprecatedState

type DeprecatedState struct {
	RemoteDevservers []string // list of devserver URLs used by remote tests.
	TestNamesToSkip  []string // tests that match patterns but are not sent to runners to run
}

DeprecatedState hold state attributes which are accumulated over the course of the run.

DEPRECATED: DO NOT add new fields to this struct. DeprecatedState makes it difficult to reason about function contracts. Pass arguments explicitly instead. This struct will be removed eventually (b/191230756).

type Mode

type Mode int

Mode describes the action to perform.

const (
	// RunTestsMode indicates that tests should be run and their results reported.
	RunTestsMode Mode = iota
	// ListTestsMode indicates that tests should only be listed.
	ListTestsMode
	// GlobalRuntimeVarsMode indicates that list all GlobalRuntimeVars currently used.
	GlobalRuntimeVarsMode
)

type MutableConfig

type MutableConfig struct {
	KeyFile  string
	KeyDir   string
	Target   string
	Patterns []string
	ResDir   string

	Mode     Mode
	TastDir  string
	TrunkDir string

	Build bool

	BuildBundle        string
	BuildWorkspace     string
	BuildOutDir        string
	CheckPortageDeps   bool
	InstallPortageDeps bool

	UseEphemeralDevserver     bool
	ExtraAllowedBuckets       []string
	Devservers                []string
	BuildArtifactsURLOverride string
	DownloadPrivateBundles    bool
	DownloadMode              protocol.DownloadMode
	TLWServer                 string
	ReportsServer             string
	CompanionDUTs             map[string]string
	SwarmingTaskID            string
	BuildBucketID             string
	DUTLabConfig              *frameworkprotocol.DUTLabConfig

	LocalRunner    string
	LocalBundleDir string
	LocalDataDir   string
	LocalOutDir    string
	LocalTempDir   string

	RemoteRunner    string
	RemoteBundleDir string
	PrimaryBundle   string
	RemoteDataDir   string
	RemoteOutDir    string
	RemoteTempDir   string

	TotalShards int
	ShardIndex  int
	ShardMethod string

	SSHRetries           int
	ContinueAfterFailure bool
	CheckTestDeps        bool
	WaitUntilReady       bool
	ExtraUSEFlags        []string
	Proxy                ProxyMode
	CollectSysInfo       bool
	MaxTestFailures      int
	ExcludeSkipped       bool
	ProxyCommand         string

	TestVars         map[string]string
	VarsFiles        []string
	DefaultVarsDirs  []string
	MaybeMissingVars string

	DebuggerPorts          map[debugger.DebugTarget]int
	DebuggerPortForwarding bool

	Retries int

	SystemServicesTimeout time.Duration
	MsgTimeout            time.Duration
	WaitUntilReadyTimeout time.Duration
	MaxSysMsgLogSize      int64

	// ForceSkips is a mapping from a test name to the filter file name which specified
	// the test should be disabled.
	// Filter file example:
	//     # The following tests will disabled.
	//     -meta.DisabledTest1
	//     -meta.DisabledTest2
	ForceSkips map[string]*protocol.ForceSkip
}

MutableConfig is similar to Config, but its fields are mutable. Call Freeze to obtain a Config from MutableConfig.

func NewMutableConfig

func NewMutableConfig(mode Mode, tastDir, trunkDir string) *MutableConfig

NewMutableConfig returns a new configuration for executing test runners in the supplied mode. It sets fields that are required by SetFlags. tastDir is the base directory under which files are written (e.g. /tmp/tast). trunkDir is the path to the ChromeOS checkout (within the chroot).

func (*MutableConfig) DeriveDefaults

func (c *MutableConfig) DeriveDefaults() error

DeriveDefaults sets default config values to unset members, possibly deriving from already set members. It should be called after non-default values are set to c.

func (*MutableConfig) Freeze

func (c *MutableConfig) Freeze() *Config

Freeze returns a frozen configuration object.

func (*MutableConfig) SetFlags

func (c *MutableConfig) SetFlags(f *flag.FlagSet)

SetFlags adds common run-related flags to f that store values in Config.

type ProxyMode

type ProxyMode int

ProxyMode describes how proxies should be used when running tests.

const (
	// ProxyEnv indicates that the HTTP_PROXY, HTTPS_PROXY, and NO_PROXY environment variables
	// (and their lowercase counterparts) should be forwarded to the DUT if set on the host.
	ProxyEnv ProxyMode = iota
	// ProxyNone indicates that proxies shouldn't be used by the DUT.
	ProxyNone
)

Jump to

Keyboard shortcuts

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