zephyr/scripts/sanitycheck-tc-schema.yaml
Inaky Perez-Gonzalez 662dde6675 sanitycheck: validate YAML files w/ schemas files
This introduces an schema-based YAML validation process when loading
any YAML file, before doing any operations on them. An exception will
be raised at SanityConfigParser() if the file fails to verify with the
given schema.

Schemas are defined for the platform files in board///*.yaml and for
the (sample|testcase).yaml files. The verification is done using the
pykwalify python library. If not installed, a warning is printed and
the verification schema is skipped. At some point, we might want to
force it being installed.

The verification library is made a separate module (scl.py) so it can
be easily imported by others.

Signed-off-by: Inaky Perez-Gonzalez <inaky.perez-gonzalez@intel.com>
2017-08-07 21:19:12 -04:00

103 lines
2.7 KiB
YAML

#
# Schema to validate a YAML file describing a Zephyr test platform
#
# We load this with pykwalify
# (http://pykwalify.readthedocs.io/en/unstable/validation-rules.html),
# a YAML structure validator, to validate the YAML files that describe
# Zephyr test platforms
#
# The original spec comes from Zephyr's sanitycheck script
#
type: map
mapping:
# The sample descriptor, if present
"sample":
type: map
required: no
mapping:
"name":
type: str
required: yes
"description":
type: str
required: no
"platforms":
type: str
required: no
# The list of testcases -- IDK why this is a sequence of
# maps maps, shall just be a sequence of maps
# maybe it is just an artifact?
"tests":
type: seq
required: yes
sequence:
- type: map
matching-rule: "any"
mapping:
# The key for the testname is any, so
# regex;(([a-zA-Z0-9_]+)) for this to work, note below we
# make it required: no
regex;(([a-zA-Z0-9_]+)):
type: map
# has to be not-required, otherwise the parser gets
# confused and things it never found it
required: no
mapping:
"arch_exclude":
type: str
required: no
"arch_whitelist":
type: str
required: no
"build_only":
type: bool
required: no
"build_on_all":
type: bool
required: no
"depends_on":
type: str
required: no
"extra_args":
type: str
required: no
"extra_sections":
type: str
required: no
"filter":
type: str
required: no
"min_ram":
type: int
required: no
"min_flash":
type: int
required: no
"platform_exclude":
type: str
required: no
"platform_whitelist":
type: str
required: no
"tags":
type: str
required: yes
"timeout":
type: int
required: no
"toolchain_exclude":
type: str
required: no
"toolchain_whitelist":
type: str
required: no
"type":
type: str
enum: [ 'unit' ]
"skip":
type: bool
required: no
"slow":
type: bool
required: no