planner

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

Documentation

Overview

Package planner contains logic to build and execute a test plan.

Index

Constants

View Source
const (

	// DefaultGracePeriod is default recommended grace period for SafeCall.
	DefaultGracePeriod = 30 * time.Second
)

Variables

This section is empty.

Functions

func RunTests

func RunTests(ctx context.Context, tests []*protocol.ResolvedEntity, out OutputStream, pcfg *Config) error

RunTests runs a set of tests, writing outputs to out.

RunTests is responsible for building an efficient plan to run the given tests. Therefore the order of tests in the argument is ignored; it just specifies a set of tests to run.

RunTests runs tests on goroutines. If a test does not finish after reaching its timeout, this function returns with an error without waiting for its finish.

func RunTestsLegacy

func RunTestsLegacy(ctx context.Context, tests []*testing.TestInstance, out OutputStream, pcfg *Config) error

RunTestsLegacy runs a set of tests, writing outputs to out.

RunTestsLegacy is responsible for building an efficient plan to run the given tests. Therefore the order of tests in the argument is ignored; it just specifies a set of tests to run.

RunTestsLegacy runs tests on goroutines. If a test does not finish after reaching its timeout, this function returns with an error without waiting for its finish.

Types

type Config

type Config struct {
	// Dirs holds several directory paths important for running tests.
	Dirs *protocol.RunDirectories

	// Features contains software/hardware features the DUT has, and runtime variables.
	Features *protocol.Features

	// ServiceConfig contains configurations of external services available to
	// Tast framework and Tast tests.
	Service *protocol.ServiceConfig

	// DataFileConfig contains configurations about data files.
	DataFile *protocol.DataFileConfig

	// RemoteData contains information relevant to remote tests.
	// It is nil for local tests.
	RemoteData *testing.RemoteData
	// TestHook is run before TestInstance.Func (and TestInstance.Pre.Prepare, when applicable) if non-nil.
	// The returned closure is executed after a test if not nil.
	TestHook func(context.Context, *testing.TestHookState) func(context.Context, *testing.TestHookState)

	// BeforeDownload specifies a function called before downloading external data files.
	// It is ignored if it is nil.
	BeforeDownload func(context.Context)
	// Tests is a map from a test name to its metadata.
	Tests map[string]*testing.TestInstance
	// Fixtures is a map from a fixture name to its metadata.
	Fixtures map[string]*testing.FixtureInstance
	// StartFixtureName is a name of a fixture to start test execution.
	// Tests requested to run should depend on the start fixture directly or
	// indirectly.
	// Since a start fixture is treated specially (e.g. no output directory is
	// created), metadata of a start fixture must not be contained in
	// Config.Fixtures. Instead, StartFixtureImpl gives an implementation of
	// a start fixture.
	StartFixtureName string
	// StartFixtureImpl gives an implementation of a start fixture.
	// If it is nil, a default stub implementation is used.
	StartFixtureImpl testing.FixtureImpl
	// CustomGracePeriod specifies custom grace period after entity timeout.
	// If nil reasonable default will be used. Config.GracePeriod() returns
	// the grace period to use. This field exists for unit testing.
	CustomGracePeriod *time.Duration

	// ExternalTarget represents configs for running an external bundle from
	// current bundle. (i.e. local bundle from remote bundle).
	ExternalTarget *ExternalTarget

	//MaxSysMsgLogSize is a size of flag for truncate log file.
	MaxSysMsgLogSize int64
}

Config contains details about how the planner should run tests.

func (*Config) FixtureConfig

func (c *Config) FixtureConfig() *fixture.Config

FixtureConfig returns a fixture config derived from c.

func (*Config) GracePeriod

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

GracePeriod returns grace period after entity timeout.

type ExternalTarget

type ExternalTarget struct {
	Device *protocol.TargetDevice
	Config *protocol.RunTargetConfig
	Bundle string
}

ExternalTarget specifies the external target bundle to run.

type FixtureStack

type FixtureStack = fixture.InternalStack

FixtureStack maintains a stack of fixtures and their states.

func NewFixtureStack

func NewFixtureStack(cfg *Config, out OutputStream) *FixtureStack

NewFixtureStack creates a new empty fixture stack.

type OutputStream

type OutputStream = output.Stream

OutputStream is an interface to report streamed outputs of multiple entity runs.

Directories

Path Synopsis
internal
entity
Package entity provides common operations for entities.
Package entity provides common operations for entities.
fixture
Package fixture provides fixture stack data structure.
Package fixture provides fixture stack data structure.
output
Package output defines output stream from entities.
Package output defines output stream from entities.
output/outputtest
Package outputtest provides functionalities for unit testing output package.
Package outputtest provides functionalities for unit testing output package.

Jump to

Keyboard shortcuts

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