1/*
2 * Copyright (C) 2018 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16syntax = "proto3";
17
18import "google/protobuf/any.proto";
19import "google/protobuf/timestamp.proto";
20import "tools/tradefederation/core/proto/metric_measurement.proto";
21
22option java_package = "com.android.tradefed.result.proto";
23option java_outer_classname = "TestRecordProto";
24
25package android_test_record;
26
27// A record containing the status, logs, and other information associated with a
28// particular test execution.
29message TestRecord {
30  // The UUID of this TestRecord.
31  string test_record_id = 1;
32
33  // The UUID of this TestRecord's parent. Unset if this is a top-level record.
34  string parent_test_record_id = 2;
35
36  // References to any finer-grained TestRecords that were generated as part of
37  // this test.
38  repeated ChildReference children = 3;
39
40  // The number of children this TestRecord was expected to have. Unset if not
41  // known in advance.
42  int64 num_expected_children = 4;
43
44  // The result status (Pass, Fail, etc) of this test unit.
45  TestStatus status = 5;
46
47  // Extra debugging information.
48  DebugInfo debug_info = 6;
49
50  // The time at which this test started executing.
51  google.protobuf.Timestamp start_time = 7;
52
53  // The time at which this test finished executing.
54  google.protobuf.Timestamp end_time = 8;
55
56  // Any artifact files associated with this test.
57  map<string, google.protobuf.Any> artifacts = 9;
58
59  // Any metrics or measurements associated with this test.
60  map<string, tradefed.metric.Metric> metrics = 10;
61
62  // Metadata describing the test that was run.
63  google.protobuf.Any description = 11;
64
65  // The attempt number of a target if the target ran several times. First
66  // attempt is 0 (Default value).
67  int64 attempt_id = 12;
68
69  // Described whether the record is skipped and why
70  SkipReason skip_reason = 13;
71}
72
73// A reference to a finer-grained TestRecord.
74message ChildReference {
75  oneof reference {
76    // The UUID of the TestRecord.
77    string test_record_id = 1;
78
79    // An inlined TestRecord.
80    TestRecord inline_test_record = 2;
81  }
82}
83
84// The overall pass / fail status for a particular TestRecord.
85enum TestStatus {
86  UNKNOWN = 0;
87  PASS = 1;
88  FAIL = 2;
89  IGNORED = 3;
90  ASSUMPTION_FAILURE = 4;
91}
92
93// Describe the reason for skipping an invocation, module or test
94message SkipReason {
95  // A message description of the reason
96  string reason = 1;
97
98  // The trigger for the skip
99  string trigger = 2;
100}
101
102// Associated debugging information to accompany a TestStatus.
103message DebugInfo {
104  // An error message.
105  string error_message = 1;
106
107  // A stacktrace.
108  string trace = 2;
109
110  // A more detailed failure status description.
111  FailureStatus failure_status = 3;
112
113  // Optional context to the failure
114  DebugInfoContext debug_info_context = 4;
115}
116
117// A Fail TestStatus can be associated with a more granular failure status that helps understanding
118// the context.
119enum FailureStatus {
120  UNSET = 0;
121  // The test in progress was the reason for the failure.
122  TEST_FAILURE = 1;
123  // A timeout condition on the operation in progress occurred.
124  TIMED_OUT = 2;
125  // The test in progress was cancelled.
126  CANCELLED = 3;
127  // A failure attributed to something not functioning properly.
128  INFRA_FAILURE = 10;
129  // System under test crashed and caused the test to fail.
130  SYSTEM_UNDER_TEST_CRASHED = 20;
131  // The test was expected to run but did not.
132  NOT_EXECUTED = 30;
133  // System under test became unavailable and never came back available again.
134  LOST_SYSTEM_UNDER_TEST = 35;
135  // Represent an error caused by an unmet dependency that the current infra
136  // depends on. For example: Unfound resources, Device error, Hardware issue
137  // (lab host, device wear), Underlying tools
138  DEPENDENCY_ISSUE = 40;
139  // Represent an error caused by the input from the end user. For example:
140  // Unexpected option combination, Configuration error, Bad flags
141  CUSTOMER_ISSUE = 41;
142}
143
144// A context to DebugInfo that allows to optionally specify some debugging context.
145message DebugInfoContext {
146  // Category of the action that was in progress during the failure
147  string action_in_progress = 1;
148
149  // A free-formed text that can help debugging the issue at hand.
150  string debug_help_message = 10;
151
152  // The fully-qualified name of the exception class associated with the error.
153  string error_type = 20;
154
155  // Error Identifiers
156  // The name identifying the error
157  string error_name = 30;
158  // The class that raised the error
159  string origin = 31;
160  // The error code associated with the error_name
161  int64 error_code = 32;
162}
163