xref: /aosp_15_r20/cts/tests/mediapc/requirements/requirements.proto (revision b7c941bb3fa97aba169d73cee0bed2de8ac964bf)
1// Copyright (C) 2024 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto2";
16
17// Changes to this file require manaul update of the AOSP Go code.
18// update the go code with:
19//   aprotoc --go_out=paths=source_relative:. \
20//     cts/tests/mediapc/requirements/mpc.proto \
21//     cts/tests/mediapc/requirements/requirements.proto
22
23package android.media.performanceclass.requirements;
24
25import "cts/tests/mediapc/requirements/mpc.proto";
26
27option java_multiple_files = true;
28
29option go_package = "cts/test/mediapc/requirements/requirements_go_proto";
30
31// A list of requirements.
32message RequirementList {
33  repeated Requirement requirements = 1;
34  // All valid MPC levels
35  repeated int64 all_mpcs = 2 [packed = true];
36}
37
38// A Media Performance Class Requirement with required measurements and
39// specifications including required values for each relevant MPC level.
40message Requirement {
41  // ID exactly as shown in the CDD
42  optional string id = 1;
43  // Short human readable name. Must be unique.
44  optional string name = 2;
45  optional string description = 3;
46  optional Group group = 4;
47
48  map<int64, RequirementSpec> specs = 5;
49
50  // measurement_id to RequiredMeasurements
51  // The measurement_id is a field name safe string.
52  map<string, RequiredMeasurement> measurements = 6;
53
54  // Whether this requirement is a non-CTS test. Cts tests require fields in the
55  // test cases proto to be repeated fields. Non-Cts tests need optional fields.
56  optional bool is_non_cts_test = 7 [default = false];
57
58  // Tests may use different setups depending on which performance class(es)
59  // are being tested. This field specifies a list of identifiers for each
60  // setup. Each identifier must have at least one corresponding entry in specs.
61  // The list can just be a single entry of a blank string if only one setup
62  // exists.
63  map<string, TestConfig> test_configs = 8;
64
65  // variant_id to Variant
66  //
67  // The variant_id is a field name safe string.
68  map<string, Variant> variants = 57;
69}
70
71message RequirementSpec {
72  optional android.media.performanceclass.MediaPerformanceClass mpc =
73      1;
74  // The specification of the requirement at the given MPC level exactly as
75  // described in the CDD.
76  optional string specification = 3;
77
78  // measurement_id to RequiredMeasurements
79  //
80  // The measurement_id is a field name safe string.
81  // The measurement_id must match the id of a RequiredMeasurement in the parent
82  // Requirement.
83  map<string, RequiredValue> required_values = 4;
84
85  // variant_id to VariantSpec
86  // The variant_id is a field name safe string.
87  map<string, VariantSpec> variant_specs = 5;
88
89  // The test config id to use for this spec. If not specified, defaults to an
90  // empty string.
91  optional string test_config_id = 6 [default = ""];
92}
93
94enum Group {
95  GROUP_UNSPECIFIED = 0;
96  GROUP_MEDIA = 1;
97  GROUP_CAMERA = 2;
98  GROUP_HARDWARE = 3;
99  GROUP_PERFORMANCE = 4;
100}
101
102// A required measurement needed verifiy a MPC requirement.
103message RequiredMeasurement {
104  // The id is a field name safe string.
105  optional string id = 1;
106  optional string description = 2;
107  optional MeasurementType measurement_type = 3;
108  optional Comparison comparison = 4;
109
110  reserved 5;  // is_test_differentiator
111
112  // Must be unique per requirement and greater than or equal to 3.
113  optional int32 proto_field_number = 6;
114}
115
116// A required value for a RequiredMeasurement at a given MPC level.
117message RequiredValue {
118  // The id is a field name safe string.
119  optional string id = 1;
120  reserved 2;  // comparison
121  oneof value {
122    string string_value = 3;
123    int64 int_value = 4;
124    double double_value = 5;
125    bool bool_value = 6;
126    int64 long_value = 7;
127    float float_value = 8;
128  }
129}
130
131// Variants are used when an alternative set of required values should apply
132message Variant {
133  // When the variant should be used.
134  optional string description = 1;
135}
136
137// The set values required for a variant
138message VariantSpec {
139  // measurement_id to RequiredMeasurements
140  //
141  // The measurement_id is a field name safe string.
142  // The measurement_id must match the id of a RequiredMeasurement in the parent
143  // Requirement.
144  map<string, RequiredValue> required_values = 4;
145}
146
147message TestConfig {
148  reserved 1;  // id
149  optional string description = 2;
150  // The proto field number of the test config. Must be unique across all
151  // requirements.
152  optional int32 proto_field_number = 3;
153}
154
155enum Comparison {
156  COMPARISON_UNSPECIFIED = 0;
157  COMPARISON_EQUAL = 1;
158  COMPARISON_LESS_THAN = 2;
159  COMPARISON_LESS_THAN_OR_EQUAL = 3;
160  COMPARISON_GREATER_THAN = 4;
161  COMPARISON_GREATER_THAN_OR_EQUAL = 5;
162  COMPARISON_INFO_ONLY = 6;
163  COMPARISON_CONFIG = 7;
164  COMPARISON_CAMERA_HARDWARE_LEVEL_GREATER_THAN_OR_EQUAL = 8;
165}
166
167enum MeasurementType {
168  MEASUREMENT_TYPE_UNSPECIFIED = 0;
169  MEASUREMENT_TYPE_BOOL = 1;
170  MEASUREMENT_TYPE_DOUBLE = 2;
171  MEASUREMENT_TYPE_INT = 3;
172  MEASUREMENT_TYPE_STRING = 4;
173  MEASUREMENT_TYPE_LONG = 5;
174  MEASUREMENT_TYPE_FLOAT = 6;
175}
176