From b0792bbfa299812e7f7a76406d0247a9e5a5e1fd Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 20 Feb 2025 05:28:38 -0500 Subject: [PATCH] twister: config: test on integration plaforms if defined Add option to force integration mode on a defined list of tests, for example tests for sample that are identified with 'sample.'. A sample per definition shall be tested on documented and supported platforms listed in the sample documentation. Samples shall not be used as tests to verify functionality of a feature on all available plaforms in Zephyr. To still allow testing on platforms not listed in the doc, and when such platforms are covered by the provided filter, we should still be able to build/run the tests on those platforms (not directly listed in integration_platforms). We detect a sample by its test identifier, i.e., it starts with 'sample.'. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/testplan.py | 11 +++++--- .../schemas/twister/test-config-schema.yaml | 9 +++++++ tests/test_config_ci.yaml | 25 +++++++++++++++++++ 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 tests/test_config_ci.yaml diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 7eb795e8a35..098d9047d3b 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -786,11 +786,14 @@ class TestPlan: if self.options.integration: platform_scope = integration_platforms else: - # if not in integration mode, still add integration platforms to the list + platform_scope = platforms if not platform_filter: - platform_scope = platforms + integration_platforms - else: - platform_scope = platforms + tco = self.test_config.get('options', {}) + im = tco.get('integration_mode', []) + if any(ts.id.startswith(i) for i in im): + platform_scope = integration_platforms + else: + platform_scope += integration_platforms else: platform_scope = platforms diff --git a/scripts/schemas/twister/test-config-schema.yaml b/scripts/schemas/twister/test-config-schema.yaml index d8e29204e40..24a92c34361 100644 --- a/scripts/schemas/twister/test-config-schema.yaml +++ b/scripts/schemas/twister/test-config-schema.yaml @@ -4,6 +4,15 @@ type: map mapping: + "options": + type: map + required: false + mapping: + "integration_mode": + type: seq + required: false + sequence: + - type: str "platforms": type: map required: false diff --git a/tests/test_config_ci.yaml b/tests/test_config_ci.yaml new file mode 100644 index 00000000000..5f09c5bb08d --- /dev/null +++ b/tests/test_config_ci.yaml @@ -0,0 +1,25 @@ +options: + integration_mode: + - sample. +platforms: + override_default_platforms: false + increased_platform_scope: true +levels: + - name: smoke + description: > + A plan to be used verifying basic zephyr features on hardware. + adds: + - kernel.threads.* + - kernel.timer.behavior + - arch.interrupt + - boards.* + - drivers.gpio.1pin + - drivers.console.uart + - drivers.entropy + - name: acceptance + description: > + More coverage + inherits: + - smoke + adds: + - kernel.*