From 9d314ff86d7e7d2f57a4f326308b57f197bdc7d4 Mon Sep 17 00:00:00 2001 From: Yong Cong Sin Date: Tue, 12 Dec 2023 15:40:49 +0800 Subject: [PATCH] twister: implement `simulation_exclude` filter This gives us the flexibility to exclude certain platforms' simulator that's known to fail from running in Twister, but allows real hardware to be tested. Signed-off-by: Yong Cong Sin --- .../pylib/twister/twisterlib/config_parser.py | 1 + .../pylib/twister/twisterlib/testinstance.py | 3 +- scripts/schemas/twister/testsuite-schema.yaml | 36 +++++++++++++++++++ scripts/twister | 3 ++ 4 files changed, 42 insertions(+), 1 deletion(-) diff --git a/scripts/pylib/twister/twisterlib/config_parser.py b/scripts/pylib/twister/twisterlib/config_parser.py index 53732876247..843fce51a7c 100644 --- a/scripts/pylib/twister/twisterlib/config_parser.py +++ b/scripts/pylib/twister/twisterlib/config_parser.py @@ -70,6 +70,7 @@ class TwisterConfigParser: "platform_exclude": {"type": "set"}, "platform_allow": {"type": "set"}, "platform_key": {"type": "list", "default": []}, + "simulation_exclude": {"type": "list", "default": []}, "toolchain_exclude": {"type": "set"}, "toolchain_allow": {"type": "set"}, "filter": {"type": "str"}, diff --git a/scripts/pylib/twister/twisterlib/testinstance.py b/scripts/pylib/twister/twisterlib/testinstance.py index 24ab66ae030..3b307e41cf2 100644 --- a/scripts/pylib/twister/twisterlib/testinstance.py +++ b/scripts/pylib/twister/twisterlib/testinstance.py @@ -219,7 +219,8 @@ class TestInstance: target_ready = bool(self.testsuite.type == "unit" or \ self.platform.type == "native" or \ - self.platform.simulation in SUPPORTED_SIMS or \ + (self.platform.simulation in SUPPORTED_SIMS and \ + self.platform.simulation not in self.testsuite.simulation_exclude) or \ filter == 'runnable') # check if test is runnable in pytest diff --git a/scripts/schemas/twister/testsuite-schema.yaml b/scripts/schemas/twister/testsuite-schema.yaml index cdf05ac699e..31aacc76edf 100644 --- a/scripts/schemas/twister/testsuite-schema.yaml +++ b/scripts/schemas/twister/testsuite-schema.yaml @@ -157,6 +157,24 @@ mapping: required: false sequence: - type: str + "simulation_exclude": + type: seq + required: false + sequence: + - type: str + enum: + [ + "qemu", + "simics", + "xt-sim", + "renode", + "nsim", + "mdb-nsim", + "tsim", + "armfvp", + "native", + "custom", + ] "tags": type: any required: false @@ -356,6 +374,24 @@ mapping: matching: "all" sequence: - type: str + "simulation_exclude": + type: seq + required: false + sequence: + - type: str + enum: + [ + "qemu", + "simics", + "xt-sim", + "renode", + "nsim", + "mdb-nsim", + "tsim", + "armfvp", + "native", + "custom", + ] "tags": type: any required: false diff --git a/scripts/twister b/scripts/twister index c66b81d84e1..aa075beb7a1 100755 --- a/scripts/twister +++ b/scripts/twister @@ -90,6 +90,9 @@ pairs: platform_exclude: Set of platforms that this test case should not run on. + simulation_exclude: + Set of simulators that this test case should not run on. + extra_sections: When computing sizes, twister will report errors if it finds extra, unexpected sections in the Zephyr binary unless they are named