twister: add support for platform_type filter

Instead of relying on runtime filter to limit scope to emulation
platforms, use the type attribute for each platform and do the filtering
very early on. This will speed things up for tests where we only run on
emulation platforms.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2022-05-14 09:00:04 -04:00
commit a6f924db7f
9 changed files with 33 additions and 7 deletions

View file

@ -1761,6 +1761,7 @@ class TestSuite(DisablePyTestCollectionMixin):
self.skip = False
self.platform_exclude = None
self.platform_allow = None
self.platform_type = []
self.toolchain_exclude = None
self.toolchain_allow = None
self.ts_filter = None
@ -3012,6 +3013,7 @@ class TestPlan(DisablePyTestCollectionMixin):
"extra_sections": {"type": "list", "default": []},
"integration_platforms": {"type": "list", "default": []},
"testcases": {"type": "list", "default": []},
"platform_type": {"type": "list", "default": []},
"platform_exclude": {"type": "set"},
"platform_allow": {"type": "set"},
"toolchain_exclude": {"type": "set"},
@ -3389,6 +3391,7 @@ class TestPlan(DisablePyTestCollectionMixin):
ts.skip = ts_dict["skip"]
ts.platform_exclude = ts_dict["platform_exclude"]
ts.platform_allow = ts_dict["platform_allow"]
ts.platform_type = ts_dict["platform_type"]
ts.toolchain_exclude = ts_dict["toolchain_exclude"]
ts.toolchain_allow = ts_dict["toolchain_allow"]
ts.ts_filter = ts_dict["filter"]
@ -3673,6 +3676,9 @@ class TestPlan(DisablePyTestCollectionMixin):
if ts.platform_allow and plat.name not in ts.platform_allow:
discards[instance] = discards.get(instance, "Not in testsuite platform allow list")
if ts.platform_type and plat.type not in ts.platform_type:
discards[instance] = discards.get(instance, "Not in testsuite platform type list")
if ts.toolchain_allow and toolchain not in ts.toolchain_allow:
discards[instance] = discards.get(instance, "Not in testsuite toolchain allow list")

View file

@ -104,6 +104,11 @@ mapping:
"platform_allow":
type: str
required: false
"platform_type":
type: seq
required: false
sequence:
- type: str
"tags":
type: str
required: false
@ -247,6 +252,11 @@ mapping:
"platform_allow":
type: str
required: false
"platform_type":
type: seq
required: false
sequence:
- type: str
"tags":
type: str
required: false

View file

@ -1,4 +1,5 @@
tests:
arch.common.semihost:
arch_allow: arm arm64 riscv32 riscv64
filter: CONFIG_QEMU_TARGET
platform_type:
- qemu

View file

@ -13,5 +13,6 @@ tests:
drivers.console.semihost:
tags: drivers console
arch_allow: arm arm64 riscv32 riscv64
filter: CONFIG_QEMU_TARGET
platform_type:
- qemu
extra_args: CONF_FILE=prj_semihost.conf

View file

@ -1,5 +1,7 @@
common:
filter: CONFIG_QEMU_TARGET or CONFIG_BOARD_NATIVE_POSIX
platform_type:
- qemu
- native
tags: cbprintf
# FIXME: qemu_arc_hs6x excluded, see #38041
platform_exclude: qemu_arc_hs6x

View file

@ -1,5 +1,7 @@
common:
filter: CONFIG_QEMU_TARGET or CONFIG_BOARD_NATIVE_POSIX
platform_type:
- qemu
- native
tags: log_api logging
integration_platforms:
- native_posix

View file

@ -1,5 +1,7 @@
common:
filter: CONFIG_QEMU_TARGET or CONFIG_BOARD_NATIVE_POSIX
platform_type:
- qemu
- native
tags: log_api logging
# FIXME: qemu_arc_hs6x excluded, see #38041
platform_exclude: qemu_arc_hs6x

View file

@ -1,5 +1,6 @@
common:
filter: CONFIG_QEMU_TARGET
platform_type:
- qemu
tags: log_api logging
integration_platforms:
- qemu_x86

View file

@ -1,6 +1,7 @@
common:
tags: test_framework
filter: CONFIG_QEMU_TARGET
platform_type:
- qemu
tests:
testing.ztest.ztress:
integration_platforms: