@@ -11,11 +11,13 @@ more features, subsystems, or modules. This includes kernel services, drivers, p
11
11
Samples should be limited in scope and should focus only on demonstrating non-trivial or
12
12
essential aspects of the subsystem(s) or module(s) being highlighted.
13
13
14
+ Samples are recommended when submitting new features; however, they are not mandatory.
15
+
14
16
Sample Criteria
15
17
===============
16
18
17
- 1. Samples must not be used as a testcase.
18
- ++++++++++++++++++++++++++++++++++++++++++
19
+ 1. Samples must not be used to test features or verify platforms
20
+ ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
19
21
* The primary purpose of a sample is to provide a reference to the user.
20
22
* Samples must not use Zephyr's testing framework.
21
23
@@ -25,7 +27,13 @@ Sample Criteria
25
27
* If a sample can provide output that can be verified, then output should be evaluated against
26
28
expected value to have some level of testing for the sample itself.
27
29
Refer to :ref: `twister_script ` for more details.
28
- * Samples are optional.
30
+
31
+ * Although being able to run a sample successfully does verify the
32
+ functionality is working as expected, this should not replace dedicated and
33
+ comprehensive tests with full coverage to be submitted into the
34
+ :zephyr_file: `tests/ ` folder. In a sample, the only thing you test is
35
+ buildability and, in some cases, if a sample is performing as expected, i.e. you
36
+ are testing the sample, not the subsystem it builds on top.
29
37
30
38
2. Twister should be able to build every sample.
31
39
++++++++++++++++++++++++++++++++++++++++++++++++
@@ -39,36 +47,42 @@ Sample Criteria
39
47
sample.kernel.cond_var :
40
48
integration_platforms :
41
49
- native_sim
42
- tags : kernel condition_variables
50
+ tags :
51
+ - kernel
52
+ - condition_variables
43
53
harness : console
44
54
harness_config :
45
55
type : one_line
46
56
regex :
47
57
- " .*Waited and joined with 3 threads"
48
58
49
- **Guidelines for Samples: **
50
- * Minimize the use of ``platform_allow `` and architecture filters.
51
- * Do not mark the test as build only unless necessary.
52
- * Any test case-specific configuration options are added using ``extra_args `` or
53
- ``extra_configs `` options in the YAML file. The `prj.conf ` file should have the in-common
54
- configuration options.
55
- * The sample itself can be evaluated using multiple configurations in the sample's YAML file.
56
- For example, the sample is used to run with different logging modes using multiple scenarios
57
- in ``samples/subsys/logging/syst ``.
58
- * Sample output can be validated leveraging the ``harness_config `` regex option,
59
- wherever applicable.
60
-
61
- 3. Samples should target multiple platforms and architectures.
62
- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
63
- * Minimize the use of ``platform_allow `` and architecture filters as it limits the scope
64
- of testing to the mentioned platforms and architectures.
65
- Reference: :ref: `twister_script `
59
+ * Do not mark the test as build only. A sample should be able to build *and *
60
+ run on the documented platforms. Use the ``harness `` option to skip the
61
+ execution. Twister only attempts to flash and execute the build binary if
62
+ the harness is set to ``ztest `` or ``console ``.
63
+ * The default configuration for the sample must be in the :file: `prj.conf `
64
+ file and should be operational on all supported platforms. Do not rely on the
65
+ ``extra_args `` or ``extra_configs `` options in the YAML file to build the
66
+ sample.
67
+ * The tests should verify the default configuration of the sample and any
68
+ optional features documented in the sample's README file. Sample should
69
+ never be used to test functionality of the subsystem or module the sample
70
+ belongs to.
71
+ * Any documented configuration options related to the sample and its
72
+ operation can be verified using ``extra_args `` or
73
+ ``extra_configs `` options in the YAML file. The :file: `prj.conf ` file should have the
74
+ base configuration options.
75
+ * Sample output can be validated by leveraging the ``harness_config `` regex option,
76
+ wherever applicable.
77
+ * Use ``platform_allow `` to limit test to the platforms the sample was actually
78
+ verified on. Those platforms should be listed in the sample's README file.
66
79
* Make use of ``integration_platforms `` to limit the scope when there are timing or
67
- resource constraints.
80
+ resource constraints. Ideally, one platform should be enough to verify the
81
+ sample when changes are submitted to the Zephyr tree via a pull-request.
68
82
* Make the sample as generic as possible. Avoid making a sample platform specific unless it is
69
83
for particular hardware.
70
84
71
- 4 . A sample should provide sufficient coverage of a subsystem, feature, or module.
85
+ 3 . A sample should provide sufficient coverage of a subsystem, feature, or module.
72
86
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
73
87
**DO's: **
74
88
* Cover the most common and important use cases of the functionality.
@@ -78,17 +92,17 @@ Sample Criteria
78
92
* Samples must not test the negative or edge case behaviors.
79
93
* Must not be unit tests.
80
94
81
- 5 . Samples must be documented.
95
+ 4 . Samples must be documented.
82
96
++++++++++++++++++++++++++++++
83
97
* Samples must have a ``README.rst `` file in the samples folder.
84
98
Example: ``samples/subsys/foo/README.rst ``. clearly explaining the purpose of the sample, its
85
- HW requirements, and the expected sample output, if applicable.
99
+ hardware requirements, and the expected sample output, if applicable.
86
100
* Ensure that the ``README.rst `` file is accessible in the sample hierarchy starting at
87
101
``samples/index.rst ``.
88
102
89
103
**README Template: **
90
104
* Overview, if applicable.
91
- * SW/HW requirements
105
+ * Software/Hardware requirements
92
106
* Building & Running instructions
93
107
* Sample output, if applicable.
94
108
0 commit comments