• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright 2020 Google LLC
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 */
16
17syntax = "proto3";
18
19package stress_test;
20
21option optimize_for = CODE_SIZE;
22
23message LoggingEventConfig {
24  // The process name that this event can be found on, or LOGCAT to come from
25  // 'adb logcat'.
26  string source = 1;
27  // The name of the event to trigger.
28  string name = 2;
29  // A list of regexes that can be used to detect the specified event.
30  repeated string regex = 3;
31}
32
33message TimeStampConfig {
34  enum TimeStampType {
35    UNKNOWN = 0;
36    DATE = 1;
37    MONOTONIC = 2;
38  }
39  // If the type is DATE, then we assume it can be parsed by a python datetime.
40  // MONOTONIC sources are from the device's boot time.
41  TimeStampType type = 3;
42  // The regex to extract the string containing the timestamp.
43  string regex = 4;
44  // The format string to pass to the python datetime constructor for the
45  // matched regex.
46  string date_format = 5;
47  // The multiplier used on the parsed monotonic time to convert it to seconds.
48  double monotonic_to_seconds_multiplier = 6;
49}
50
51message FileConfig {
52  // The file that should be cat-ed on device to get information. Will be used
53  // by LoggingEventConfigs.
54  string source = 1;
55  // The filepath to save the output of this file on the local machine. If
56  // blank, will be discarded.
57  string destination = 2;
58  // The information needed to extract timestamps from the config.
59  TimeStampConfig time_stamp = 3;
60  // True if the file spits out a bit of the buffer that it did previously when
61  // reopened (like the logcat does).
62  bool repeats_output_on_open = 4;
63}
64
65message ProcessConfig {
66  // The command to run to produce logging output.
67  string command = 1;
68  // The name of the process to be used in LoggingEventConfigs.
69  string name = 2;
70  // The filepath to save the output of this process on the local machine. If
71  // blank, will be discarded.
72  string destination = 3;
73  // The information needed to extract timestamps from the config.
74  TimeStampConfig time_stamp = 4;
75  // Restart the process if it crashes randomly.
76  bool restart = 5;
77  // True if the file spits out a bit of the buffer that it did previously when
78  // reopened (like the logcat does).
79  bool repeats_output_on_open = 6;
80}
81
82message DeviceConfig {
83  // Commands to run once at the beginning of the test for the device.
84  repeated string setup_command = 1;
85  // Files that should have their contents monitored for events.
86  repeated FileConfig file_to_watch = 2;
87  // Files that should be moved to the local machine after every iteration of
88  // the stress test.
89  repeated FileConfig file_to_move = 3;
90  // All events that can be triggered by this device.
91  repeated LoggingEventConfig event = 5;
92  // Any processes that should be monitored for events.
93  repeated ProcessConfig daemon_process = 6;
94  // Include any other device definitions before processing the contents of this
95  // one. Note that if duplicate entries exist for the repeated elements (based
96  // on the name), only the "latest" in the include chain will be used.
97  repeated string include = 7;
98  // A list of tags that should be squelched from the logcat - useful for super
99  // spammy irrelevant logcat tags.
100  repeated string tag_to_suppress = 8;
101  // Either a TestEventConfig without a condition (but a name) that allows extra
102  // actions to take place when a specific test event occurs, or a standard test
103  // event that will be invoked regardless of which test is running.
104  repeated TestEventConfig test_event = 9;
105}
106
107message TestStep {
108  // Path to raw audio file to play during this test step.
109  string audio_file = 1;
110  // Sample rate of audio file.
111  int32 audio_file_sample_rate = 2;
112  // Number of channels in audio file.
113  int32 audio_file_num_channels = 3;
114  // The sox format of the audio file.
115  string audio_file_format = 4;
116  // Command to run on this test step.
117  string command = 5;
118  // How many seconds to wait before executing the command/playing the sound in
119  // this step.
120  float delay_before = 6;
121  // How many seconds to wait after executing the command/playing the sound in
122  // this step.
123  float delay_after = 7;
124}
125
126message ExpectedResult {
127  int32 aohd_hotword_detected = 1;
128  int32 assistant_started = 2;
129  int32 dsp_false_accept = 3;
130  int32 logcat_iteration = 4;
131  int32 software_hotword = 5;
132  int32 speaker_id_rejected = 6;
133  int32 vis_software_hotword = 7;
134}
135
136message TestEventConfig {
137  // The name of the event. (Used for readability/allowing devices to add custom
138  // actions when an event of a specific name occurs).
139  string name = 1;
140  // An eval condition that should only be true when the actions in this event
141  // should be executed.
142  string condition = 2;
143  // List of actions to take when the condition is satisfied. BUGREPORT, NOTIFY,
144  // REMOVE_DEVICE and ABORT are all special values that take a bugreport, send
145  // an email, remove the device from the test or stops stress testing
146  // respectively.
147  repeated string action = 3;
148}
149
150message StressTestConfig {
151  // Description of what the test does.
152  string description = 1;
153  // List of steps to take in sequence repeatedly to do the stress test.
154  repeated TestStep step = 2;
155  // Events that trigger special actions on the device when the condition is
156  // satisfied.
157  repeated TestEventConfig event = 3;
158  // Commands that should be run at the beginning of the test to setup the
159  // device.
160  repeated string setup_command = 4;
161  // Definition of Expected test result
162  repeated ExpectedResult expected_result = 5;
163}
164
165message EventLogDetails {
166  int32 iteration = 1;
167  string name = 2;
168}
169
170message EventLog {
171  repeated EventLogDetails event = 1;
172}
173
174message DeviceIdentifier {
175  string device_type = 1;
176  string serial_number = 2;
177}
178
179message StressTestInfo {
180  // Metadata info describing the devices involved in the stress test, and a bit
181  // about what test was actually run.
182  string test_name = 1;
183  string test_description = 2;
184  string uuid = 3;
185  repeated DeviceIdentifier device = 4;
186}
187