|
10 | 10 | import sys |
11 | 11 | from typing import List |
12 | 12 | import yaml |
| 13 | +import re |
13 | 14 |
|
14 | 15 |
|
15 | 16 | SOC_SCHEMA_PATH = str(Path(__file__).parent / 'schemas' / 'soc-schema.yml') |
@@ -40,6 +41,40 @@ def __init__(self, folder='', soc_yaml=None): |
40 | 41 | except (yaml.YAMLError, pykwalify.errors.SchemaError) as e: |
41 | 42 | sys.exit(f'ERROR: Malformed yaml {soc_yaml.as_posix()}', e) |
42 | 43 |
|
| 44 | + # Ensure that any runner configuration matches socs and cpuclusters declared in the same |
| 45 | + # soc.yml file |
| 46 | + if 'runners' in data and 'run_once' in data['runners']: |
| 47 | + for grp in data['runners']['run_once']: |
| 48 | + for item_data in data['runners']['run_once'][grp]: |
| 49 | + for group in item_data['groups']: |
| 50 | + for qualifiers in group['qualifiers']: |
| 51 | + components = qualifiers.split('/') |
| 52 | + soc = components.pop(0) |
| 53 | + found_match = False |
| 54 | + |
| 55 | + # Allow 'ns' as final qualifier until "virtual" CPUs are ported to soc.yml |
| 56 | + # https://github.com/zephyrproject-rtos/zephyr/issues/70721 |
| 57 | + if len(components) > 0 and components[len(components)-1] == 'ns': |
| 58 | + components.pop(len(components)-1) |
| 59 | + |
| 60 | + for f in data.get('family', []): |
| 61 | + for s in f.get('series', []): |
| 62 | + for socs in s.get('socs', []): |
| 63 | + if re.match(fr'^{soc}$', socs.get('name')) is not None: |
| 64 | + if 'cpuclusters' in socs and len(components) > 0: |
| 65 | + check_string = '/'.join(components) |
| 66 | + for cpucluster in socs.get('cpuclusters', []): |
| 67 | + if re.match(fr'^{check_string}$', cpucluster.get('name')) is not None: |
| 68 | + found_match = True |
| 69 | + break |
| 70 | + elif 'cpuclusters' not in socs and len(components) == 0: |
| 71 | + found_match = True |
| 72 | + break |
| 73 | + |
| 74 | + |
| 75 | + if found_match is False: |
| 76 | + sys.exit(f'ERROR: SoC qualifier match unresolved: {qualifiers}') |
| 77 | + |
43 | 78 | for f in data.get('family', []): |
44 | 79 | family = Family(f['name'], folder, [], []) |
45 | 80 | for s in f.get('series', []): |
|
0 commit comments