Skip to content

Commit baeee77

Browse files
gmarulljgl-meta
authored andcommitted
twister: automatically add module board roots
Twister does not handle out-of-tree boards automatically. Modules like e.g. example-application that define their own board root folder, are required to inform twister via `--board-root`. In contrast, west is able to to this automatically. This patch makes twister a bit smarter by automatically filling the board root list with module paths as well. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
1 parent fa51172 commit baeee77

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/pylib/twister/twisterlib/environment.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@
2626
if not ZEPHYR_BASE:
2727
sys.exit("$ZEPHYR_BASE environment variable undefined")
2828

29+
sys.path.insert(0, os.path.join(ZEPHYR_BASE, "scripts/"))
30+
31+
import zephyr_module
32+
2933
# Use this for internal comparisons; that's what canonicalization is
3034
# for. Don't use it when invoking other components of the build system
3135
# to avoid confusing and hard to trace inconsistencies in error messages
@@ -228,6 +232,12 @@ def add_parse_arguments(parser = None):
228232
board_root_list = ["%s/boards" % ZEPHYR_BASE,
229233
"%s/scripts/pylib/twister/boards" % ZEPHYR_BASE]
230234

235+
modules = zephyr_module.parse_modules(ZEPHYR_BASE)
236+
for module in modules:
237+
board_root = module.meta.get("build", {}).get("settings", {}).get("board_root")
238+
if board_root:
239+
board_root_list.append(os.path.join(module.project, board_root, "boards"))
240+
231241
parser.add_argument(
232242
"-A", "--board-root", action="append", default=board_root_list,
233243
help="""Directory to search for board configuration files. All .yaml

0 commit comments

Comments
 (0)