luci: go.chromium.org/luci/resultdb/cmd/recorder/chromium/formats Index | Files

package formats

import "go.chromium.org/luci/resultdb/cmd/recorder/chromium/formats"

Index

Package Files

common.go gtest.go json.go

Constants

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"
)

type GTestResults Uses

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 Uses

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 Uses

func (r *GTestResults) ToProtos(ctx context.Context, testPathPrefix string, inv *pb.Invocation) ([]*pb.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.

type GTestRunResult Uses

type GTestRunResult struct {
    Status        string `json:"status"`
    ElapsedTimeMs int    `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 Uses

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_path_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 Uses

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 Uses

func (r *JSONTestResults) ToProtos(ctx context.Context, testPathPrefix string, inv *pb.Invocation, outputs map[string]*pb.Artifact) ([]*pb.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.

Uses outputs, the isolated outputs associated with the task, to populate artifacts. Does not populate TestResult.Name; that happens server-side on RPC response.

type Location Uses

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

Location describes a code location.

type TestFields Uses

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

    Artifacts map[string][]string `json:"artifacts"`

    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.

Package formats imports 23 packages (graph) and is imported by 1 packages. Updated 2019-12-14. Refresh now. Tools for package owners.