twister: update twister testplan.py to handle HWMv2 boards
This commit updates twister testplan.py to handle HWMv2 boards. It does so by switching to use list_boards.py to obtain a list of folders containing <board>.yaml files for processing instead of a global globbing of sub-folders under boards. With HWMv2, boards can be organized more freely, meaning that a fixed glob hierarchy is no longer safe. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
committed by
Jamie McCrae
parent
1f026f70eb
commit
baa55141a1
@@ -18,6 +18,7 @@ import shutil
|
||||
import random
|
||||
import snippets
|
||||
from pathlib import Path
|
||||
from argparse import Namespace
|
||||
|
||||
logger = logging.getLogger('twister')
|
||||
logger.setLevel(logging.DEBUG)
|
||||
@@ -34,7 +35,7 @@ from twisterlib.config_parser import TwisterConfigParser
|
||||
from twisterlib.testinstance import TestInstance
|
||||
from twisterlib.quarantine import Quarantine
|
||||
|
||||
|
||||
import list_boards
|
||||
from zephyr_module import parse_modules
|
||||
|
||||
ZEPHYR_BASE = os.getenv("ZEPHYR_BASE")
|
||||
@@ -398,13 +399,24 @@ class TestPlan:
|
||||
|
||||
|
||||
def add_configurations(self):
|
||||
for board_root in self.env.board_roots:
|
||||
board_root = os.path.abspath(board_root)
|
||||
logger.debug("Reading platform configuration files under %s..." %
|
||||
board_root)
|
||||
board_dirs = set()
|
||||
# Create a list of board roots as defined by the build system in general
|
||||
# Note, internally in twister a board root includes the `boards` folder
|
||||
# but in Zephyr build system, the board root is without the `boards` in folder path.
|
||||
board_roots = [Path(os.path.dirname(root)) for root in self.env.board_roots]
|
||||
lb_args = Namespace(arch_roots=[Path(ZEPHYR_BASE)], soc_roots=[Path(ZEPHYR_BASE)],
|
||||
board_roots=board_roots, board=None)
|
||||
v1_boards = list_boards.find_boards(lb_args)
|
||||
v2_boards = list_boards.find_v2_boards(lb_args)
|
||||
for b in v1_boards:
|
||||
board_dirs.add(b.dir)
|
||||
for b in v2_boards:
|
||||
board_dirs.add(b.dir)
|
||||
logger.debug("Reading platform configuration files under %s..." % self.env.board_roots)
|
||||
|
||||
platform_config = self.test_config.get('platforms', {})
|
||||
for file in glob.glob(os.path.join(board_root, "*", "*", "*.yaml")):
|
||||
platform_config = self.test_config.get('platforms', {})
|
||||
for folder in board_dirs:
|
||||
for file in glob.glob(os.path.join(folder, "*.yaml")):
|
||||
try:
|
||||
platform = Platform()
|
||||
platform.load(file)
|
||||
|
||||
Reference in New Issue
Block a user