Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

west: build: also parse common section in yaml file #60557

Merged
merged 2 commits into from
Jul 24, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 23 additions & 16 deletions scripts/west_commands/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,30 +270,37 @@ def _parse_test_item(self, test_item):
y = yaml.safe_load(stream)
except yaml.YAMLError as exc:
log.die(exc)
common = y.get('common')
tests = y.get('tests')
if not tests:
log.die(f"No tests found in {yf}")
item = tests.get(test_item)
if not item:
log.die(f"Test item {test_item} not found in {yf}")

for data in ['extra_args', 'extra_configs']:
extra = item.get(data)
if not extra:
sysbuild = False
for section in [common, item]:
if not section:
continue
if isinstance(extra, str):
arg_list = extra.split(" ")
else:
arg_list = extra
if data == 'extra_configs':
args = ["-D{}".format(arg.replace('"', '\"')) for arg in arg_list]
elif data == 'extra_args':
args = ["-D{}".format(arg.replace('"', '')) for arg in arg_list]
if self.args.cmake_opts:
self.args.cmake_opts.extend(args)
else:
self.args.cmake_opts = args
self.args.sysbuild = item.get('sysbuild')
sysbuild = section.get('sysbuild', sysbuild)
for data in ['extra_args', 'extra_configs']:
extra = section.get(data)
if not extra:
continue
if isinstance(extra, str):
arg_list = extra.split(" ")
else:
arg_list = extra
if data == 'extra_configs':
args = ["-D{}".format(arg.replace('"', '\"')) for arg in arg_list]
elif data == 'extra_args':
args = ["-D{}".format(arg.replace('"', '')) for arg in arg_list]
if self.args.cmake_opts:
self.args.cmake_opts.extend(args)
else:
self.args.cmake_opts = args

self.args.sysbuild = sysbuild
return found_test_metadata

def _sanity_precheck(self):
Expand Down
Loading