Skip to content

Commit 4e208cf

Browse files
committed
scripts: twister: adding overlaying option in harness config
Adding functionality to split harness_config into common and test-case specific part, which are joined together for any given test. Signed-off-by: Artur Dobrynin <[email protected]>
1 parent 58d2834 commit 4e208cf

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

scripts/pylib/twister/twisterlib/config_parser.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ def get_scenario(self, name: str) -> dict[str, Any]:
182182
if k == "filter":
183183
d[k] = f"({d[k]}) and ({v})"
184184
elif k not in ("extra_conf_files", "extra_overlay_confs",
185-
"extra_dtc_overlay_files"):
185+
"extra_dtc_overlay_files", "harness_config"):
186186
if isinstance(d[k], str) and isinstance(v, list):
187187
d[k] = [d[k]] + v
188188
elif isinstance(d[k], list) and isinstance(v, str):
@@ -204,6 +204,22 @@ def get_scenario(self, name: str) -> dict[str, Any]:
204204
else:
205205
d[k] = v
206206

207+
harness_config = copy.deepcopy(self.common.get("harness_config", {}))
208+
if 'harness_config' in self.scenarios[name]:
209+
if harness_config:
210+
for k, v in self.scenarios[name]['harness_config'].items():
211+
if k in harness_config:
212+
if isinstance(harness_config[k], list):
213+
harness_config[k] += v if isinstance(v, list) else [v]
214+
else:
215+
harness_config[k] = v
216+
else:
217+
harness_config[k] = v
218+
else:
219+
harness_config = self.scenarios[name]['harness_config']
220+
221+
d['harness_config'] = harness_config
222+
207223
# Compile conf files in to a single list. The order to apply them is:
208224
# (1) CONF_FILEs extracted from common['extra_args']
209225
# (2) common['extra_conf_files']

0 commit comments

Comments
 (0)