test_platform: add user facing proto for skylab test result

BUG=chromium:1081426
TEST=NA

Change-Id: Ie27b79d9a04e90be8f01385fc9d13d6595b039f3
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/infra/proto/+/2194486
Commit-Queue: Xinan Lin <linxinan@chromium.org>
Tested-by: Xinan Lin <linxinan@chromium.org>
Reviewed-by: Alex Zamorzaev <zamorzaev@chromium.org>
diff --git a/src/test_platform/analytics/result.proto b/src/test_platform/analytics/result.proto
new file mode 100644
index 0000000..5aada40
--- /dev/null
+++ b/src/test_platform/analytics/result.proto
@@ -0,0 +1,170 @@
+// Copyright 2020 The Chromium OS Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+syntax = "proto3";
+
+package test_platform.analytics;
+
+import "google/protobuf/timestamp.proto";
+
+option go_package = "go.chromium.org/chromiumos/infra/proto/go/test_platform/analytics";
+
+// TestPlanRun represents the test request defined by users and its running
+// status.
+message TestPlanRun {
+  // A unique name to identify this test plan run, format
+  // "testPlanRuns/{testPlanRun}", where {} is a UUID,
+  // e.g. "testPlanRuns/8df26977-469d-4a85-a0e8-b1f42ca4a888"
+  // Required field.
+  string uid = 1;
+
+  // Suite name. If the test plan is running an autotest suite,
+  // this field is the autotest suite name, e.g. wifi_interop.
+  string suite = 2;
+
+  // Human friendly url to access this run.
+  string execution_url = 3;
+
+  // The dut_pool in which the test plan ran, e.g. "DUT_POOL_QUOTA" or
+  // "wificell".
+  // It is case sensitive: "WIFICELL" and "wificell" represent different
+  // pools.
+  // Note that legacy pools "suites", "bvt" and "pcq" have been integrated
+  // into "DUT_POOL_QUOTA" and legacy pool "cts" has been renamed to
+  // "DUT_POOL_CTS".
+  string dut_pool = 4;
+
+  // The build target, a.k.a board name, e.g. "hatch", "octopus".
+  string build_target = 5;
+
+  // CrOS build version, e.g. "R84/13091.0.0".
+  string chromeos_build = 6;
+
+  Status status = 7;
+
+  // Event timestamp of test plan run, e.g. start time, end time.
+  Timeline timeline = 8;
+}
+
+// TestRun contains Skylab task level information.
+message TestRun {
+  // A unique name for this test run, format "testRuns/{testRun}",
+  // where {} is a UUID.
+  // Required field.
+  string uid = 1;
+
+  // The name of the Skylab task corresponding to the test run, e.g.
+  // "tast.critical-chrome".
+  //
+  // For tasks containing a single test case, will generally be the same as the
+  // name of that test case, e.g. "provision_AutoUpdate.double".
+  // Required field.
+  string display_name = 2;
+
+  // Human friendly url to access this run.
+  string execution_url = 3;
+
+  // The TestPlanRun.uid of the parent test plan run.
+  string parent_uid = 4;
+
+  // Model name, e.g. "helios", "mimrock".
+  // Note that a single TestPlanRun may be spread across multiple models, if
+  // the test plan request did not specify a model to run.
+  string model = 5;
+
+  // Event timestamp of test run, e.g. start time, end time.
+  Timeline timeline = 6;
+
+  Status status = 7;
+
+  Verdict verdict = 8;
+
+  // The URL for the entire logs of this run.
+  string full_log_url = 9;
+
+  message Prejob {
+    Verdict verdict = 1;
+  }
+  Prejob prejob = 10;
+}
+
+// TestCaseResult describes the result of an individual test case.
+message TestCaseResult {
+  // A unique name for this test case run,
+  // format "testCaseResults/{testCaseResult}" where {} is a UUID.
+  // Required field.
+  string uid = 1;
+
+  // Test case name as it appears in status.log,
+  // e.g. "provision_AutoUpdate.double".
+  string display_name = 2;
+
+  // The TestRun.uid of the parent test run.
+  string parent_uid = 3;
+
+  Verdict verdict = 4;
+
+  // A one line human readable description of what happened during test
+  // case execution (e.g. error/warning message). Not intended to be machine
+  // parseable. There's no guarantee that a given root cause will always
+  // resolve to the same summary.
+  string human_readable_summary = 5;
+}
+
+// The timeline of a task.
+message Timeline {
+  // Time the task was requested.
+  google.protobuf.Timestamp create_time = 1;
+  // Time the task began to execute in a bot.
+  google.protobuf.Timestamp start_time = 2;
+  // Time the task completed, unset if the task was
+  // stopped unexpectedly before its completion.
+  google.protobuf.Timestamp end_time = 3;
+  // Time the task was stopped unexpectedly, unset if
+  // task has run to its end.
+  google.protobuf.Timestamp abandon_time = 4;
+}
+
+// The latest known status of a task, may change as the run progresses.
+message Status {
+  // All the currently possible values (corresponding to
+  // testplatform.Taskstate.LifeCycle enum values):
+  //   NORMAL STATUS:
+  //
+  //     PENDING: task is pending somewhere and does not run.
+  //     RUNNING: task is running.
+  //     COMPLETED: ran to completion without being cancelled externally,
+  //       regardless of whether it succeeded or failed. A task is completed
+  //       only if all its sub-tasks have reached the end, either with a normal
+  //       or abnormal status.
+  //
+  //   ABNORMAL STATUS:
+  //
+  //     CANCELLED: never got a chance to run, cancelled externally.
+  //     REJECTED: never got a chance to run, rejected due to unsatisfiable
+  //       depenedencies.
+  //     ABORTED: started running but was cancelled externally while running.
+  string value = 1;
+}
+
+// The known tokens describe whether a task passed, failed, or had some other
+// indefinite verdict.
+message Verdict {
+  // All the currently possible values (corresponding to
+  // testplatform.Taskstate.Verdict enum values):
+  //
+  //   UNSPECIFIED(default): the task produced no usable verdict (possibly
+  //     because it never ran, or never finished, or the results were
+  //     unparseable).
+  //     Under most circumstances, this should be treated as a failure or
+  //     an infrastructure failure.
+  //   PASSED: test run definitively passed.
+  //   FAILED: test run definitively failed.
+  //   NO_VERDICT: the task definitively produced no verdict(for instance,
+  //     the test is irrelevant in the given environment).
+  //     Under most circumstances, this should be treated as a passing
+  //     (but uninteresting).
+  //   PASSED_ON_RETRY: the task failed, but passed after one or more retries.
+  string value = 1;
+}
\ No newline at end of file