formats

package
v0.0.0-...-4a11b79 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2020 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OriginalFormatTagKey is a key of the tag indicating the format of the
	// source data. Possible values: FormatJTR, FormatGTest.
	OriginalFormatTagKey = "orig_format"

	// FormatJTR is Chromium's JSON Test Results format.
	FormatJTR = "chromium_json_test_results"

	// FormatGTest is Chromium's GTest format.
	FormatGTest = "chromium_gtest"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GTestResults

type GTestResults struct {
	AllTests   []string `json:"all_tests"`
	GlobalTags []string `json:"global_tags"`

	// PerIterationData is a vector of run iterations, each mapping test names to a list of test data.
	PerIterationData []map[string][]*GTestRunResult `json:"per_iteration_data"`

	// TestLocations maps test names to their location in code.
	TestLocations map[string]*Location `json:"test_locations"`
}

GTestResults represents the structure as described to be generated in https://cs.chromium.org/chromium/src/base/test/launcher/test_results_tracker.h?l=83&rcl=96020cfd447cb285acfa1a96c37a67ed22fa2499 (base::TestResultsTracker::SaveSummaryAsJSON)

Fields not used by Test Results are omitted.

func (*GTestResults) ConvertFromJSON

func (r *GTestResults) ConvertFromJSON(ctx context.Context, reader io.Reader) error

ConvertFromJSON reads the provided reader into the receiver.

The receiver is cleared and its fields overwritten.

func (*GTestResults) ToProtos

func (r *GTestResults) ToProtos(ctx context.Context, testIDPrefix string, inv *pb.Invocation) ([]*TestResult, error)

ToProtos converts test results in r []*pb.TestResult and updates inv in-place accordingly. If an error is returned, inv is left unchanged.

Does not populate TestResult.Name or TestResult.ResultId.

type GTestRunResult

type GTestRunResult struct {
	Status        string  `json:"status"`
	ElapsedTimeMs float64 `json:"elapsed_time_ms"`

	LosslessSnippet     bool   `json:"losless_snippet"`
	OutputSnippetBase64 string `json:"output_snippet_base64"`

	// Links are not generated by test_launcher, but harnesses built on top may add them to the json.
	Links map[string]string `json:"links"`
}

GTestRunResult represents the per_iteration_data as described in https://cs.chromium.org/chromium/src/base/test/launcher/test_results_tracker.h?l=83&rcl=96020cfd447cb285acfa1a96c37a67ed22fa2499 (base::TestResultsTracker::SaveSummaryAsJSON)

Fields not used by Test Results are omitted.

type JSONTestResults

type JSONTestResults struct {
	Interrupted bool `json:"interrupted"`

	PathDelimiter string `json:"path_delimiter"`

	TestsRaw json.RawMessage `json:"tests"`
	Tests    map[string]*TestFields

	Version int32 `json:"version"`

	ArtifactTypes map[string]string `json:"artifact_types"`

	BuildNumber string `json:"build_number"`
	BuilderName string `json:"builder_name"`

	// Metadata associated with results, which may include a list of expectation_files, or
	// test_name_prefix e.g. in GPU tests (distinct from test_id_prefix passed in the recorder API
	// request).
	Metadata map[string]json.RawMessage `json:"metadata"`
}

JSONTestResults represents the structure in https://chromium.googlesource.com/chromium/src/+/master/docs/testing/json_test_results_format.md

Deprecated fields and fields not used by Test Results are omitted.

func (*JSONTestResults) ConvertFromJSON

func (r *JSONTestResults) ConvertFromJSON(ctx context.Context, reader io.Reader) error

ConvertFromJSON converts a JSON of test results in the JSON Test Results format to the internal struct format.

The receiver is cleared and its fields overwritten.

func (*JSONTestResults) ToProtos

func (r *JSONTestResults) ToProtos(ctx context.Context, testIDPrefix, locationPrefix string, inv *pb.Invocation, availableArtifacts stringset.Set) ([]*TestResult, error)

ToProtos converts test results in r []*pb.TestResult and updates inv in-place accordingly. If an error is returned, inv is left unchanged.

Does not populate TestResult.Name or TestResult.ResultId.

type Location

type Location struct {
	File string `json:"file"`
	Line int    `json:"line"`
}

Location describes a code location.

type TestFields

type TestFields struct {
	Actual   string `json:"actual"`
	Expected string `json:"expected"`

	// TODO(crbug/1034021): Support only map[string][]string, as spec'd by the JSON Test Results
	// Format.
	ArtifactsRaw map[string]json.RawMessage `json:"artifacts"`
	Artifacts    map[string][]string

	Time  float64   `json:"time"`
	Times []float64 `json:"times"`
}

TestFields represents the test fields structure in https://chromium.googlesource.com/chromium/src/+/master/docs/testing/json_test_results_format.md

Deprecated fields and fields not used by Test Results are omitted.

type TestResult

type TestResult struct {
	*pb.TestResult

	// Artifacts maps from short artifact names to artifact keys.
	Artifacts map[string]string
}

TestResult combines a test result with associated artifact keys.

Jump to

Keyboard shortcuts

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