twister: run slow tests only

We have many tests that are marked as slow that do not run in CI and any
known workflow, to isolate them and be able to run them on their own,
add a new option --enable-slow-only which causes only those tests to build
and execute.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2023-06-22 13:58:25 +00:00
commit b8fc1c3607
2 changed files with 10 additions and 0 deletions

View file

@ -553,9 +553,15 @@ structure in the main Zephyr tree: boards/<arch>/<board_name>/""")
parser.add_argument( parser.add_argument(
"-S", "--enable-slow", action="store_true", "-S", "--enable-slow", action="store_true",
default="--enable-slow-only" in sys.argv,
help="Execute time-consuming test cases that have been marked " help="Execute time-consuming test cases that have been marked "
"as 'slow' in testcase.yaml. Normally these are only built.") "as 'slow' in testcase.yaml. Normally these are only built.")
parser.add_argument(
"--enable-slow-only", action="store_true",
help="Execute time-consuming test cases that have been marked "
"as 'slow' in testcase.yaml only. This also set the option --enable-slow")
parser.add_argument( parser.add_argument(
"--seed", type=int, "--seed", type=int,
help="Seed for native posix pseudo-random number generator") help="Seed for native posix pseudo-random number generator")

View file

@ -624,6 +624,7 @@ class TestPlan:
runnable = (self.options.device_testing or self.options.filter == 'runnable') runnable = (self.options.device_testing or self.options.filter == 'runnable')
force_toolchain = self.options.force_toolchain force_toolchain = self.options.force_toolchain
force_platform = self.options.force_platform force_platform = self.options.force_platform
slow_only = self.options.enable_slow_only
ignore_platform_key = self.options.ignore_platform_key ignore_platform_key = self.options.ignore_platform_key
emu_filter = self.options.emulation_only emu_filter = self.options.emulation_only
@ -748,6 +749,9 @@ class TestPlan:
if tag_filter and not ts.tags.intersection(tag_filter): if tag_filter and not ts.tags.intersection(tag_filter):
instance.add_filter("Command line testsuite tag filter", Filters.CMD_LINE) instance.add_filter("Command line testsuite tag filter", Filters.CMD_LINE)
if slow_only and not ts.slow:
instance.add_filter("Not a slow test", Filters.CMD_LINE)
if exclude_tag and ts.tags.intersection(exclude_tag): if exclude_tag and ts.tags.intersection(exclude_tag):
instance.add_filter("Command line testsuite exclude filter", Filters.CMD_LINE) instance.add_filter("Command line testsuite exclude filter", Filters.CMD_LINE)