-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[Backport v3.7-branch] twister: setup soc/arch roots based on module settings #77822
Conversation
Get data for various roots from modules and do not hardcode location when retrieving list of boards in testplan. Fixes #71761 Signed-off-by: Anas Nashif <[email protected]> (cherry picked from commit d145db0)
if soc_root: | ||
self.soc_roots.append(os.path.join(module.project, soc_root)) | ||
dts_root = module.meta.get("build", {}).get("settings", {}).get("dts_root") | ||
if soc_root: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if soc_root: | |
if dts_root: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm unsure, but using the path names as path-like objects helps to avoid an attribute exception.
self.dts_roots.append(os.path.join(module.project, dts_root)) | ||
arch_root = module.meta.get("build", {}).get("settings", {}).get("arch_root") | ||
if arch_root: | ||
self.arch_roots.append(os.path.join(module.project, arch_root)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: append with path-like object (PEP 519):
self.arch_roots.append(os.path.join(module.project, arch_root)) | |
self.arch_roots.append(Path(os.path.join(module.project, arch_root))) |
OR:
self.arch_roots.append(os.path.join(module.project, arch_root)) | |
self.arch_roots.append(Path(module.project) / arch_root) |
otherwise following line will cause AttributeError: 'str' object has no attribute '_closed'
:
v1_boards = list_boards.find_boards(lb_args) |
full traceback:
Traceback (most recent call last):
File "./zephyr/scripts/twister", line 215, in <module>
ret = main(options, default_options)
File "/.../workspace/zephyr/scripts/pylib/twister/twisterlib/twister_main.py", line 124, in main
tplan.discover()
File "/.../workspace/zephyr/scripts/pylib/twister/twisterlib/testplan.py", line 197, in discover
self.add_configurations()
File "/.../workspace/zephyr/scripts/pylib/twister/twisterlib/testplan.py", line 410, in add_configurations
v1_boards = list_boards.find_boards(lb_args)
File "/.../workspace/zephyr/scripts/list_boards.py", line 117, in find_boards
return sorted(itertools.chain(*find_arch2board_set(args).values()),
File "/.../workspace/zephyr/scripts/list_boards.py", line 122, in find_arch2board_set
arches = sorted(find_arches(args))
File "/.../workspace/zephyr/scripts/list_boards.py", line 138, in find_arches
for root in unique_paths(args.arch_roots):
File "/.../workspace/zephyr/scripts/list_hardware.py", line 182, in unique_paths
yield from dict.fromkeys(map(Path.resolve, paths)).keys()
File "/usr/lib/python3.8/pathlib.py", line 1179, in resolve
if self._closed:
self.soc_roots.append(os.path.join(module.project, soc_root)) | ||
dts_root = module.meta.get("build", {}).get("settings", {}).get("dts_root") | ||
if soc_root: | ||
self.dts_roots.append(os.path.join(module.project, dts_root)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: see arch_roots
below
self.dts_roots.append(os.path.join(module.project, dts_root)) | |
self.dts_roots.append(Path(os.path.join(module.project, dts_root))) |
OR:
self.dts_roots.append(os.path.join(module.project, dts_root)) | |
self.dts_roots.append(Path(module.project) / dts_root) |
for module in modules: | ||
soc_root = module.meta.get("build", {}).get("settings", {}).get("soc_root") | ||
if soc_root: | ||
self.soc_roots.append(os.path.join(module.project, soc_root)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: see arch_roots
below
self.soc_roots.append(os.path.join(module.project, soc_root)) | |
self.soc_roots.append(Path(os.path.join(module.project, soc_root))) |
OR:
self.soc_roots.append(os.path.join(module.project, soc_root)) | |
self.soc_roots.append(Path(module.project) / soc_root) |
Backport d145db0 from #77163.
Fixes #71761