twister: support filtering by vendor
Add a new option --vendor which allows filtering by vendors tracked in the board/platform yaml file. The vendor string is compatible with DTS and is what we have in dts/bindings/vendor-prefixes.txt. Providing multiple vendors is also supported. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
85c4111002
commit
3966d30a4f
4 changed files with 24 additions and 3 deletions
|
@ -481,6 +481,10 @@ structure in the main Zephyr tree: boards/<arch>/<board_name>/""")
|
||||||
that support this feature (currently only Linux).
|
that support this feature (currently only Linux).
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
parser.add_argument(
|
||||||
|
"--vendor", action="append", default=[],
|
||||||
|
help="Vendor filter for testing")
|
||||||
|
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"-p", "--platform", action="append", default=[],
|
"-p", "--platform", action="append", default=[],
|
||||||
help="Platform filter for testing. This option may be used multiple "
|
help="Platform filter for testing. This option may be used multiple "
|
||||||
|
|
|
@ -36,6 +36,8 @@ class Platform:
|
||||||
self.supported = set()
|
self.supported = set()
|
||||||
|
|
||||||
self.arch = ""
|
self.arch = ""
|
||||||
|
self.vendor = ""
|
||||||
|
self.tier = -1
|
||||||
self.type = "na"
|
self.type = "na"
|
||||||
self.simulation = "na"
|
self.simulation = "na"
|
||||||
self.simulation_exec = None
|
self.simulation_exec = None
|
||||||
|
@ -67,6 +69,8 @@ class Platform:
|
||||||
self.supported.add(item)
|
self.supported.add(item)
|
||||||
|
|
||||||
self.arch = data['arch']
|
self.arch = data['arch']
|
||||||
|
self.vendor = data.get('vendor', '')
|
||||||
|
self.tier = data.get("tier", -1)
|
||||||
self.type = data.get('type', "na")
|
self.type = data.get('type', "na")
|
||||||
self.simulation = data.get('simulation', "na")
|
self.simulation = data.get('simulation', "na")
|
||||||
self.simulation_exec = data.get('simulation_exec')
|
self.simulation_exec = data.get('simulation_exec')
|
||||||
|
|
|
@ -623,6 +623,7 @@ class TestPlan:
|
||||||
|
|
||||||
toolchain = self.env.toolchain
|
toolchain = self.env.toolchain
|
||||||
platform_filter = self.options.platform
|
platform_filter = self.options.platform
|
||||||
|
vendor_filter = self.options.vendor
|
||||||
exclude_platform = self.options.exclude_platform
|
exclude_platform = self.options.exclude_platform
|
||||||
testsuite_filter = self.run_individual_testsuite
|
testsuite_filter = self.run_individual_testsuite
|
||||||
arch_filter = self.options.arch
|
arch_filter = self.options.arch
|
||||||
|
@ -637,29 +638,35 @@ class TestPlan:
|
||||||
emu_filter = self.options.emulation_only
|
emu_filter = self.options.emulation_only
|
||||||
|
|
||||||
logger.debug("platform filter: " + str(platform_filter))
|
logger.debug("platform filter: " + str(platform_filter))
|
||||||
|
logger.debug(" vendor filter: " + str(vendor_filter))
|
||||||
logger.debug(" arch_filter: " + str(arch_filter))
|
logger.debug(" arch_filter: " + str(arch_filter))
|
||||||
logger.debug(" tag_filter: " + str(tag_filter))
|
logger.debug(" tag_filter: " + str(tag_filter))
|
||||||
logger.debug(" exclude_tag: " + str(exclude_tag))
|
logger.debug(" exclude_tag: " + str(exclude_tag))
|
||||||
|
|
||||||
default_platforms = False
|
default_platforms = False
|
||||||
|
vendor_platforms = False
|
||||||
emulation_platforms = False
|
emulation_platforms = False
|
||||||
|
|
||||||
if all_filter:
|
if all_filter:
|
||||||
logger.info("Selecting all possible platforms per test case")
|
logger.info("Selecting all possible platforms per test case")
|
||||||
# When --all used, any --platform arguments ignored
|
# When --all used, any --platform arguments ignored
|
||||||
platform_filter = []
|
platform_filter = []
|
||||||
elif not platform_filter and not emu_filter:
|
elif not platform_filter and not emu_filter and not vendor_filter:
|
||||||
logger.info("Selecting default platforms per test case")
|
logger.info("Selecting default platforms per test case")
|
||||||
default_platforms = True
|
default_platforms = True
|
||||||
elif emu_filter:
|
elif emu_filter:
|
||||||
logger.info("Selecting emulation platforms per test case")
|
logger.info("Selecting emulation platforms per test case")
|
||||||
emulation_platforms = True
|
emulation_platforms = True
|
||||||
|
elif vendor_filter:
|
||||||
|
vendor_platforms = True
|
||||||
|
|
||||||
if platform_filter:
|
if platform_filter:
|
||||||
self.verify_platforms_existence(platform_filter, f"platform_filter")
|
self.verify_platforms_existence(platform_filter, f"platform_filter")
|
||||||
platforms = list(filter(lambda p: p.name in platform_filter, self.platforms))
|
platforms = list(filter(lambda p: p.name in platform_filter, self.platforms))
|
||||||
elif emu_filter:
|
elif emu_filter:
|
||||||
platforms = list(filter(lambda p: p.simulation != 'na', self.platforms))
|
platforms = list(filter(lambda p: p.simulation != 'na', self.platforms))
|
||||||
|
elif vendor_filter:
|
||||||
|
platforms = list(filter(lambda p: p.vendor in vendor_filter, self.platforms))
|
||||||
elif arch_filter:
|
elif arch_filter:
|
||||||
platforms = list(filter(lambda p: p.arch in arch_filter, self.platforms))
|
platforms = list(filter(lambda p: p.arch in arch_filter, self.platforms))
|
||||||
elif default_platforms:
|
elif default_platforms:
|
||||||
|
@ -706,8 +713,6 @@ class TestPlan:
|
||||||
if not c:
|
if not c:
|
||||||
platform_scope = list(filter(lambda item: item.name in ts.platform_allow, \
|
platform_scope = list(filter(lambda item: item.name in ts.platform_allow, \
|
||||||
self.platforms))
|
self.platforms))
|
||||||
|
|
||||||
|
|
||||||
# list of instances per testsuite, aka configurations.
|
# list of instances per testsuite, aka configurations.
|
||||||
instance_list = []
|
instance_list = []
|
||||||
for plat in platform_scope:
|
for plat in platform_scope:
|
||||||
|
@ -935,6 +940,10 @@ class TestPlan:
|
||||||
self.add_instances(instance_list)
|
self.add_instances(instance_list)
|
||||||
for instance in list(filter(lambda inst: not inst.platform.simulation != 'na', instance_list)):
|
for instance in list(filter(lambda inst: not inst.platform.simulation != 'na', instance_list)):
|
||||||
instance.add_filter("Not an emulated platform", Filters.CMD_LINE)
|
instance.add_filter("Not an emulated platform", Filters.CMD_LINE)
|
||||||
|
elif vendor_platforms:
|
||||||
|
self.add_instances(instance_list)
|
||||||
|
for instance in list(filter(lambda inst: not inst.platform.vendor in vendor_filter, instance_list)):
|
||||||
|
instance.add_filter("Not a selected vendor platform", Filters.CMD_LINE)
|
||||||
else:
|
else:
|
||||||
self.add_instances(instance_list)
|
self.add_instances(instance_list)
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,10 @@ mapping:
|
||||||
type: str
|
type: str
|
||||||
"arch":
|
"arch":
|
||||||
type: str
|
type: str
|
||||||
|
"vendor":
|
||||||
|
type: str
|
||||||
|
"tier":
|
||||||
|
type: int
|
||||||
"toolchain":
|
"toolchain":
|
||||||
type: seq
|
type: seq
|
||||||
seq:
|
seq:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue