Skip to content

Commit 0a7a61f

Browse files
gchwiernashif
authored andcommitted
twister: docs: Update twister docs with quarantine
Docs updated with changes proposed in #52179 Signed-off-by: Grzegorz Chwierut <[email protected]>
1 parent 6809c05 commit 0a7a61f

File tree

7 files changed

+27
-17
lines changed

7 files changed

+27
-17
lines changed

doc/develop/test/twister.rst

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,15 @@ using an external J-Link probe. The "probe_id" keyword overrides the
902902
Quarantine
903903
++++++++++
904904

905-
Twister allows using user-defined yaml files defining the list of tests to be put
906-
under quarantine. Such tests will be skipped and marked accordingly in the output
907-
reports. This feature is especially useful when running larger test suits, where
908-
a failure of one test can affect the execution of other tests (e.g. putting the
909-
physical board in a corrupted state).
905+
Twister allows user to provide onfiguration files defining a list of tests or
906+
platforms to be put under quarantine. Such tests will be skipped and marked
907+
accordingly in the output reports. This feature is especially useful when
908+
running larger test suits, where a failure of one test can affect the execution
909+
of other tests (e.g. putting the physical board in a corrupted state).
910910

911911
To use the quarantine feature one has to add the argument
912912
``--quarantine-list <PATH_TO_QUARANTINE_YAML>`` to a twister call.
913+
Multiple quarantine files can be used.
913914
The current status of tests on the quarantine list can also be verified by adding
914915
``--quarantine-verify`` to the above argument. This will make twister skip all tests
915916
which are not on the given list.
@@ -920,22 +921,33 @@ to put under quarantine. In addition, an optional entry "comment" can be used, w
920921
some more details can be given (e.g. link to a reported issue). These comments will also
921922
be added to the output reports.
922923

924+
When quarantining a class of tests or many scenarios in a single testsuite or
925+
when dealing with multiple issues within a subsystem, it is possible to use
926+
regular expressions, for example, **kernel.*** would quarantine
927+
all kernel tests.
928+
923929
An example of entries in a quarantine yaml::
924930

925931
- scenarios:
926932
- sample.basic.helloworld
927-
platforms:
928-
- all
929933
comment: "Link to the issue: https://github.com/zephyrproject-rtos/zephyr/pull/33287"
930934

931935
- scenarios:
932936
- kernel.common
933-
- kernel.common.misra
937+
- kernel.common.(misra|tls)
934938
- kernel.common.nano64
935939
platforms:
936-
- qemu_cortex_m3
940+
- .*_cortex_.*
937941
- native_posix
938942

943+
To exclude a platform, use the following syntax::
944+
945+
- platforms:
946+
- qemu_x86
947+
comment: "broken qemu"
948+
949+
Additionally you can quarantine entire architectures or a specific simulator for executing tests.
950+
939951
Running in Tests in Random Order
940952
********************************
941953
Enable ZTEST framework's :kconfig:option:`CONFIG_ZTEST_SHUFFLE` config option to

scripts/pylib/twister/twisterlib/quarantine.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class QuarantineElement:
4040
platforms: list[str] = field(default_factory=list)
4141
architectures: list[str] = field(default_factory=list)
4242
simulations: list[str] = field(default_factory=list)
43-
comment: str = 'under quarantine'
43+
comment: str = 'NA'
4444

4545
def __post_init__(self):
4646
# If there is no entry in filters then take all possible values.

scripts/pylib/twister/twisterlib/testplan.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ def apply_filters(self, **kwargs):
753753
instance.testsuite.id, plat.name, plat.arch, plat.simulation
754754
)
755755
if matched_quarantine and not self.options.quarantine_verify:
756-
instance.add_filter(matched_quarantine, Filters.QUARENTINE)
756+
instance.add_filter("Quarantine: " + matched_quarantine, Filters.QUARENTINE)
757757
if not matched_quarantine and self.options.quarantine_verify:
758758
instance.add_filter("Not under quarantine", Filters.QUARENTINE)
759759

scripts/schemas/twister/quarantine-schema.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,19 +25,19 @@ sequence:
2525
type: seq
2626
sequence:
2727
- type: str
28-
- unique: True
28+
- unique: true
2929
"architectures":
3030
required: false
3131
type: seq
3232
sequence:
3333
- type: str
34-
- unique: True
34+
- unique: true
3535
"simulations":
3636
required: false
3737
type: seq
3838
sequence:
3939
- type: str
40-
- unique: True
40+
- unique: true
4141
"comment":
4242
type: str
4343
required: false
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
- platforms:
32
- demo_board_3
43
comment: "all on board_3"

scripts/tests/twister/test_data/quarantines/with_regexp.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
- scenarios:
32
- test_(a|c).check_2
43
architectures:

scripts/tests/twister/test_testplan_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,6 @@ def test_quarantine(class_testplan, platforms_list, test_data,
332332
else:
333333
if testname in expected_val:
334334
assert instance.status == 'filtered'
335-
assert instance.reason == expected_val[testname]
335+
assert instance.reason == "Quarantine: " + expected_val[testname]
336336
else:
337337
assert not instance.status

0 commit comments

Comments
 (0)