twister: allow filtering based on modules
Support new keyword in the testcase.yaml to allow filtering based on enabled modules. This is useful when you only whitelist a limited set of modules in your project and want to only run those samples that have their dependencies satisfied and those modules available. The option allows adding multiple modules, all of which need to be enabled in the manifest. Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
parent
b48fc1d0f2
commit
f429f339fc
3 changed files with 31 additions and 1 deletions
|
@ -2960,6 +2960,7 @@ class TestSuite(DisablePyTestCollectionMixin):
|
|||
"slow": {"type": "bool", "default": False},
|
||||
"timeout": {"type": "int", "default": 60},
|
||||
"min_ram": {"type": "int", "default": 8},
|
||||
"modules": {"type": "list", "default": []},
|
||||
"depends_on": {"type": "set"},
|
||||
"min_flash": {"type": "int", "default": 32},
|
||||
"arch_allow": {"type": "set"},
|
||||
|
@ -3045,6 +3046,8 @@ class TestSuite(DisablePyTestCollectionMixin):
|
|||
self.pipeline = None
|
||||
self.version = "NA"
|
||||
|
||||
self.modules = []
|
||||
|
||||
def check_zephyr_version(self):
|
||||
try:
|
||||
subproc = subprocess.run(["git", "describe", "--abbrev=12", "--always"],
|
||||
|
@ -3338,6 +3341,7 @@ class TestSuite(DisablePyTestCollectionMixin):
|
|||
tc.build_on_all = tc_dict["build_on_all"]
|
||||
tc.slow = tc_dict["slow"]
|
||||
tc.min_ram = tc_dict["min_ram"]
|
||||
tc.modules = tc_dict["modules"]
|
||||
tc.depends_on = tc_dict["depends_on"]
|
||||
tc.min_flash = tc_dict["min_flash"]
|
||||
tc.extra_sections = tc_dict["extra_sections"]
|
||||
|
@ -3535,6 +3539,10 @@ class TestSuite(DisablePyTestCollectionMixin):
|
|||
# Discard silently
|
||||
continue
|
||||
|
||||
if tc.modules and self.modules:
|
||||
if not set(tc.modules).issubset(set(self.modules)):
|
||||
discards[instance] = discards.get(instance, f"one or more required module not available: {','.join(tc.modules)}")
|
||||
|
||||
if runnable and not instance.run:
|
||||
discards[instance] = discards.get(instance, "Not runnable on device")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue