runtests

package
v0.0.0-...-bbc9ce3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2021 License: BSD-2-Clause Imports: 12 Imported by: 0

Documentation

Overview

Package runtests contains specifics related to the runtests command.

Index

Constants

View Source
const (
	SuccessSignature = "[runtests][PASSED] "
	FailureSignature = "[runtests][FAILED] "
	StartedSignature = "RUNNING TEST: "
)
View Source
const (
	// TestSummaryFilename is the summary file name expected by the fuchsia
	// recipe module.
	TestSummaryFilename = "summary.json"

	// TestOutputFilename is the default output file name for a test.
	TestOutputFilename = "stdout-and-stderr.txt"

	// TestSuccess represents a passed test.
	TestSuccess TestResult = "PASS"

	// TestFailure represents a failed test.
	TestFailure TestResult = "FAIL"
)

Variables

This section is empty.

Functions

func TestPassed

func TestPassed(ctx context.Context, testOutput io.Reader, name string) (bool, error)

TestPassed reads in the output from a runtests invocation of a single test and returns whether that test succeeded. The expected signature, eg "runtests[PASSED] /test/name", must match the one in https://fuchsia.googlesource.com/fuchsia/+/HEAD/zircon/system/ulib/runtests-utils/fuchsia-run-test.cc

Types

type DataSink

type DataSink struct {
	// Name is the name of the sink.
	Name string `json:"name"`

	// File is the file containing the sink data.
	File string `json:"file"`

	// BuildIDs optionally provides the build IDs relevant to the data (e.g.,
	// those of the modules of a particular test). While `runtests` will not
	// actually provide this information, it is currently the most convenient
	// place to convey this information for non-Fuchsia profiles to covargs.
	// Once build IDs are automatically embedded in any emitted profile,
	// tracked by fxbug.dev/61208, this can be deleted.
	BuildIDs []string `json:"build_ids,omitempty"`
}

DataSink is a data sink exported by the test.

type DataSinkCopier

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

DataSinkCopier copies data sinks from a remote host after a runtests invocation.

func NewDataSinkCopier

func NewDataSinkCopier(client *sshutil.Client) (*DataSinkCopier, error)

NewDataSinkCopier constructs a copier using the specified ssh client.

func (DataSinkCopier) Close

func (c DataSinkCopier) Close() error

func (DataSinkCopier) Copy

func (c DataSinkCopier) Copy(references []DataSinkReference, localDir string) (DataSinkMap, error)

Copy copies data sinks using the copier's remote viewer.

func (DataSinkCopier) GetReferences

func (c DataSinkCopier) GetReferences(remoteDir string) (map[string]DataSinkReference, error)

GetReferences returns a map of test name to a reference to the remote data sinks.

func (*DataSinkCopier) Reconnect

func (c *DataSinkCopier) Reconnect() error

Reconnect should be called after the sshClient has been disconnected and reconnected. It closes the old viewer and creates a new viewer using the refreshed sshClient.

type DataSinkMap

type DataSinkMap map[string][]DataSink

DataSinkMap is mapping from a data sink name to a list of the corresponding data sink files.

type DataSinkReference

type DataSinkReference struct {
	Sinks     DataSinkMap
	RemoteDir string
}

DataSinkReference holds information about data sinks on the target.

func (DataSinkReference) Size

func (d DataSinkReference) Size() int

Size returns the number of sinks held by the reference.

type TestDetails

type TestDetails struct {
	// Name is the name of the test.
	Name string `json:"name"`

	// GNLabel is label of the test target (with toolchain).
	GNLabel string `json:"gn_label"`

	// OutputFiles are paths to the test's output files.
	OutputFiles []string `json:"output_files"`

	// Result is the result of the test.
	Result TestResult `json:"result"`

	// Cases is individual test case results.
	Cases []testparser.TestCaseResult `json:"cases"`

	// DataSinks gives the data sinks attached to a test.
	DataSinks DataSinkMap `json:"data_sinks,omitempty"`

	// StartTime is the UTC time when the test was started.
	StartTime time.Time `json:"start_time"`

	// Duration is how long the test execution took.
	DurationMillis int64 `json:"duration_milliseconds"`

	// IsTestingFailureMode is true iff this test was produced by tefmocheck.
	IsTestingFailureMode bool `json:"is_testing_failure_mode"`
}

TestDetails contains the details of a test run.

type TestResult

type TestResult string

TestResult is the exit result of a test.

type TestSummary

type TestSummary struct {
	// Tests is a list of the details of the test runs.
	Tests []TestDetails `json:"tests"`

	// Outputs gives the suite-wide outputs, mapping canonical name of the
	// output to its path.
	Outputs map[string]string `json:"outputs,omitempty"`
}

TestSummary is a summary of a suite of test runs. It represents the output file format of a runtests invocation.

Jump to

Keyboard shortcuts

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