sanitycheck: define schema for hardware map
Add schema for hardware map and verify it. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
fc85ff052f
commit
2a5d61d3ea
2 changed files with 37 additions and 5 deletions
32
scripts/sanity_chk/hwmap-schema.yaml
Normal file
32
scripts/sanity_chk/hwmap-schema.yaml
Normal file
|
@ -0,0 +1,32 @@
|
|||
type: seq
|
||||
sequence:
|
||||
- type: map
|
||||
required: no
|
||||
mapping:
|
||||
"available":
|
||||
type: bool
|
||||
required: true
|
||||
"connected":
|
||||
type: bool
|
||||
required: true
|
||||
"id":
|
||||
type: str
|
||||
required: true
|
||||
"platform":
|
||||
type: str
|
||||
required: true
|
||||
"product":
|
||||
type: str
|
||||
required: true
|
||||
"runner":
|
||||
type: str
|
||||
required: true
|
||||
"serial":
|
||||
type: str
|
||||
required: false
|
||||
"post_script":
|
||||
type: str
|
||||
required: false
|
||||
"pre_script":
|
||||
type: str
|
||||
required: false
|
|
@ -3767,6 +3767,9 @@ def native_and_unit_first(a, b):
|
|||
|
||||
|
||||
class HardwareMap:
|
||||
|
||||
schema_path = os.path.join(ZEPHYR_BASE, "scripts", "sanity_chk", "hwmap-schema.yaml")
|
||||
|
||||
manufacturer = [
|
||||
'ARM',
|
||||
'SEGGER',
|
||||
|
@ -3813,11 +3816,8 @@ class HardwareMap:
|
|||
self.connected_hardware.append(device)
|
||||
|
||||
def load_hardware_map(self, map_file):
|
||||
with open(map_file, 'r') as stream:
|
||||
try:
|
||||
self.connected_hardware = yaml.safe_load(stream)
|
||||
except yaml.YAMLError as exc:
|
||||
print(exc)
|
||||
hwm_schema = scl.yaml_load(self.schema_path)
|
||||
self.connected_hardware = scl.yaml_load_verify(map_file, hwm_schema)
|
||||
for i in self.connected_hardware:
|
||||
i['counter'] = 0
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue