Skip to content

Commit

Permalink
scripts: twister: snippet roots from modules
Browse files Browse the repository at this point in the history
Automatically populate the snippet roots from Zephyr modules, instead of
only looking in `ZEPHYR_BASE`.

Signed-off-by: Jordan Yates <[email protected]>
  • Loading branch information
Jordan Yates authored and nashif committed Jan 17, 2024
1 parent 2b2e6ba commit 8f7e3b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions scripts/pylib/twister/twisterlib/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -863,6 +863,13 @@ def __init__(self, options=None) -> None:
self.board_roots = None
self.outdir = None

self.snippet_roots = [Path(ZEPHYR_BASE)]
modules = zephyr_module.parse_modules(ZEPHYR_BASE)
for module in modules:
snippet_root = module.meta.get("build", {}).get("settings", {}).get("snippet_root")
if snippet_root:
self.snippet_roots.append(Path(module.project) / snippet_root)

self.hwm = None

self.test_config = options.test_config if options else None
Expand Down
2 changes: 1 addition & 1 deletion scripts/pylib/twister/twisterlib/testplan.py
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ def apply_filters(self, **kwargs):
if ts.required_snippets:
missing_snippet = False
snippet_args = {"snippets": ts.required_snippets}
found_snippets = snippets.find_snippets_in_roots(snippet_args, [Path(ZEPHYR_BASE), Path(ts.source_dir)])
found_snippets = snippets.find_snippets_in_roots(snippet_args, [*self.env.snippet_roots, Path(ts.source_dir)])

# Search and check that all required snippet files are found
for this_snippet in snippet_args['snippets']:
Expand Down

0 comments on commit 8f7e3b8

Please sign in to comment.