Skip to content

Commit 47102de

Browse files
committed
west: build: support additional configuration with --test-item
Also support extra_conf_files, extra_overlay_confs, extra_dtc_overlay_files Signed-off-by: Anas Nashif <[email protected]>
1 parent 6fdfc91 commit 47102de

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

scripts/west_commands/build.py

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,28 +279,66 @@ def _parse_test_item(self, test_item):
279279
log.die(f"Test item {test_item} not found in {yf}")
280280

281281
sysbuild = False
282+
extra_dtc_overlay_files = []
283+
extra_overlay_confs = []
284+
extra_conf_files = []
282285
for section in [common, item]:
283286
if not section:
284287
continue
285288
sysbuild = section.get('sysbuild', sysbuild)
286-
for data in ['extra_args', 'extra_configs']:
289+
for data in [
290+
'extra_args',
291+
'extra_configs',
292+
'extra_conf_files',
293+
'extra_overlay_confs',
294+
'extra_dtc_overlay_files'
295+
]:
287296
extra = section.get(data)
288297
if not extra:
289298
continue
290299
if isinstance(extra, str):
291300
arg_list = extra.split(" ")
292301
else:
293302
arg_list = extra
303+
294304
if data == 'extra_configs':
295305
args = ["-D{}".format(arg.replace('"', '\"')) for arg in arg_list]
296306
elif data == 'extra_args':
297307
args = ["-D{}".format(arg.replace('"', '')) for arg in arg_list]
308+
elif data == 'extra_conf_files':
309+
extra_conf_files.extend(arg_list)
310+
continue
311+
elif data == 'extra_overlay_confs':
312+
extra_overlay_confs.extend(arg_list)
313+
continue
314+
elif data == 'extra_dtc_overlay_files':
315+
extra_dtc_overlay_files.extend(arg_list)
316+
continue
317+
298318
if self.args.cmake_opts:
299319
self.args.cmake_opts.extend(args)
300320
else:
301321
self.args.cmake_opts = args
302322

303323
self.args.sysbuild = sysbuild
324+
325+
args = []
326+
if extra_conf_files:
327+
args.append(f"CONF_FILE=\"{';'.join(extra_conf_files)}\"")
328+
329+
if extra_dtc_overlay_files:
330+
args.append(f"DTC_OVERLAY_FILE=\"{';'.join(extra_dtc_overlay_files)}\"")
331+
332+
if extra_overlay_confs:
333+
args.append(f"OVERLAY_CONFIG=\"{';'.join(extra_overlay_confs)}\"")
334+
# Build the final argument list
335+
args_expanded = ["-D{}".format(a.replace('"', '')) for a in args]
336+
337+
if self.args.cmake_opts:
338+
self.args.cmake_opts.extend(args_expanded)
339+
else:
340+
self.args.cmake_opts = args_expanded
341+
304342
return found_test_metadata
305343

306344
def _sanity_precheck(self):

0 commit comments

Comments
 (0)