Documentation ¶
Overview ¶
Package planner contains logic to build and execute a test plan.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunTests ¶
func RunTests(ctx context.Context, tests []*testing.TestInstance, 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.
Types ¶
type Config ¶
type Config struct { // DataDir is the path to the base directory containing test data files. DataDir string // OutDir is the path to the base directory under which tests should write output files. OutDir string // Vars contains names and values of runtime variables used to pass out-of-band data to tests. Vars map[string]string // Features contains software/hardware features the DUT has. Features dep.Features // Devservers contains URLs of devservers that can be used to download files. Devservers []string // TLWServer is the address of TLW server TLWServer string // DUTName is the name given by the infra scheduler DUTName string // BuildArtifactsURL is the URL of Google Cloud Storage directory, ending with a slash, // containing build artifacts for the current Chrome OS image. BuildArtifactsURL string // 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) // DownloadMode specifies a strategy to download external data files. DownloadMode DownloadMode // Fixtures is a map from a fixture name to its metadata. Fixtures map[string]*testing.Fixture // 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 }
Config contains details about how the planner should run tests.
type DownloadMode ¶
type DownloadMode int
DownloadMode specifies a strategy to download external data files.
const ( // DownloadBatch specifies that the planner downloads external data files // in batch before running tests. DownloadBatch DownloadMode = iota // DownloadLazy specifies that the planner download external data files // as needed between tests. DownloadLazy )
type OutputStream ¶
type OutputStream interface { // EntityStart reports that an entity has started. EntityStart(ei *testing.EntityInfo, outDir string) error // EntityLog reports an informational log message. EntityLog(ei *testing.EntityInfo, msg string) error // EntityError reports an error from an entity. An entity that reported one or more errors should be considered failure. EntityError(ei *testing.EntityInfo, e *testing.Error) error // EntityEnd reports that an entity has ended. If skipReasons is not empty it is considered skipped. EntityEnd(ei *testing.EntityInfo, skipReasons []string, timingLog *timing.Log) error }
OutputStream is an interface to report streamed outputs of multiple entity runs. Note that testing.OutputStream is for a single entity in contrast.