1#
2# Schema to validate a YAML file describing a Zephyr test platform
3#
4# We load this with pykwalify
5# (http://pykwalify.readthedocs.io/en/unstable/validation-rules.html),
6# a YAML structure validator, to validate the YAML files that describe
7# Zephyr test platforms
8#
9# The original spec comes from Zephyr's twister script
10#
11type: map
12mapping:
13  "common":
14    type: map
15    required: false
16    mapping:
17      "arch_exclude":
18        type: any
19        required: false
20      "arch_allow":
21        type: any
22        required: false
23      "build_only":
24        type: bool
25        required: false
26      "build_on_all":
27        type: bool
28        required: false
29      "depends_on":
30        type: any
31        required: false
32      "extra_args":
33        type: any
34        required: false
35      "extra_conf_files":
36        type: seq
37        required: false
38        sequence:
39          - type: str
40      "extra_overlay_confs":
41        type: seq
42        required: false
43        sequence:
44          - type: str
45      "extra_dtc_overlay_files":
46        type: seq
47        required: false
48        sequence:
49          - type: str
50      "extra_sections":
51        type: any
52        required: false
53      "filter":
54        type: str
55        required: false
56      "integration_platforms":
57        type: seq
58        required: false
59        sequence:
60          - type: str
61      "ignore_faults":
62        type: bool
63        required: false
64      "ignore_qemu_crash":
65        type: bool
66        required: false
67      "levels":
68        type: seq
69        required: false
70        sequence:
71          - type: str
72            enum: ["smoke", "unit", "integration", "acceptance", "system", "regression"]
73      "testcases":
74        type: seq
75        required: false
76        sequence:
77          - type: str
78      "harness":
79        type: str
80        required: false
81      "harness_config":
82        type: map
83        required: false
84        mapping:
85          "type":
86            type: str
87            required: false
88          "fixture":
89            type: str
90            required: false
91          "ordered":
92            type: bool
93            required: false
94          "repeat":
95            type: int
96            required: false
97          "pytest_root":
98            type: str
99            required: false
100          "pytest_args":
101            type: seq
102            required: false
103            sequence:
104              - type: str
105          "regex":
106            type: seq
107            required: false
108            sequence:
109              - type: str
110          "robot_test_path":
111            type: str
112            required: false
113          "record":
114            type: map
115            required: false
116            mapping:
117              "regex":
118                type: str
119                required: false
120      "min_ram":
121        type: int
122        required: false
123      "min_flash":
124        type: int
125        required: false
126      "modules":
127        type: seq
128        required: false
129        sequence:
130          - type: str
131      "platform_exclude":
132        type: any
133        required: false
134      "platform_allow":
135        type: any
136        required: false
137      "platform_type":
138        type: seq
139        required: false
140        sequence:
141          - type: str
142      "platform_key":
143        required: false
144        type: seq
145        matching: "all"
146        sequence:
147          - type: str
148      "tags":
149        type: any
150        required: false
151      "timeout":
152        type: int
153        required: false
154      "toolchain_exclude":
155        type: any
156        required: false
157      "toolchain_allow":
158        type: any
159        required: false
160      "type":
161        type: str
162        enum: ["unit"]
163      "skip":
164        type: bool
165        required: false
166      "slow":
167        type: bool
168        required: false
169      "sysbuild":
170        type: bool
171        required: false
172  # The sample descriptor, if present
173  "sample":
174    type: map
175    required: false
176    mapping:
177      "name":
178        type: str
179        required: true
180      "description":
181        type: str
182        required: false
183  # The list of testcases -- IDK why this is a sequence of
184  # maps maps, shall just be a sequence of maps
185  # maybe it is just an artifact?
186  "tests":
187    type: map
188    required: true
189    matching-rule: "any"
190    mapping:
191      # The key for the testname is any, so
192      # regex;(([a-zA-Z0-9_]+)) for this to work, note below we
193      # make it required: false
194      regex;(([a-zA-Z0-9_]+)):
195        type: map
196        # has to be not-required, otherwise the parser gets
197        # confused and things it never found it
198        required: false
199        mapping:
200          "arch_exclude":
201            type: any
202            required: false
203          "arch_allow":
204            type: any
205            required: false
206          "testcases":
207            type: seq
208            required: false
209            sequence:
210              - type: str
211          "build_only":
212            type: bool
213            required: false
214          "build_on_all":
215            type: bool
216            required: false
217          "depends_on":
218            type: any
219            required: false
220          "extra_args":
221            type: any
222            required: false
223          "extra_configs":
224            type: seq
225            required: false
226            sequence:
227              - type: str
228          "extra_conf_files":
229            type: seq
230            required: false
231            sequence:
232              - type: str
233          "extra_overlay_confs":
234            type: seq
235            required: false
236            sequence:
237              - type: str
238          "extra_dtc_overlay_files":
239            type: seq
240            required: false
241            sequence:
242              - type: str
243          "extra_sections":
244            type: any
245            required: false
246          "filter":
247            type: str
248            required: false
249          "levels":
250            type: seq
251            required: false
252            sequence:
253              - type: str
254                enum: ["smoke", "unit", "integration", "acceptance", "system", "regression"]
255          "integration_platforms":
256            type: seq
257            required: false
258            sequence:
259              - type: str
260          "ignore_faults":
261            type: bool
262            required: false
263          "ignore_qemu_crash":
264            type: bool
265            required: false
266          "harness":
267            type: str
268            required: false
269          "harness_config":
270            type: map
271            required: false
272            mapping:
273              "type":
274                type: str
275                required: false
276              "fixture":
277                type: str
278                required: false
279              "ordered":
280                type: bool
281                required: false
282              "repeat":
283                type: int
284                required: false
285              "pytest_root":
286                type: str
287                required: false
288              "pytest_args":
289                type: seq
290                required: false
291                sequence:
292                  - type: str
293              "regex":
294                type: seq
295                required: false
296                sequence:
297                  - type: str
298              "robot_test_path":
299                type: str
300                required: false
301              "record":
302                type: map
303                required: false
304                mapping:
305                  "regex":
306                    type: str
307                    required: false
308          "min_ram":
309            type: int
310            required: false
311          "min_flash":
312            type: int
313            required: false
314          "modules":
315            type: seq
316            required: false
317            sequence:
318              - type: str
319          "platform_exclude":
320            type: any
321            required: false
322          "platform_allow":
323            type: any
324            required: false
325          "platform_type":
326            type: seq
327            required: false
328            sequence:
329              - type: str
330          "platform_key":
331            required: false
332            type: seq
333            matching: "all"
334            sequence:
335              - type: str
336          "tags":
337            type: any
338            required: false
339          "timeout":
340            type: int
341            required: false
342          "toolchain_exclude":
343            type: any
344            required: false
345          "toolchain_allow":
346            type: any
347            required: false
348          "type":
349            type: str
350            enum: ["unit"]
351          "skip":
352            type: bool
353            required: false
354          "slow":
355            type: bool
356            required: false
357          "sysbuild":
358            type: bool
359            required: false
360