Skip to content

Commit e5cedca

Browse files
marc-hbnashif
authored andcommitted
sanitycheck help: how to spot tests that were not run and just built
There are a few reasons why sanitycheck will only build a test and not run it: list them in the developer guide. Also lists the --options that provide that information and update their --help message. A couple other --help fixes. Signed-off-by: Marc Herbert <[email protected]>
1 parent d7ca903 commit e5cedca

File tree

2 files changed

+33
-9
lines changed

2 files changed

+33
-9
lines changed

doc/guides/test/sanitycheck.rst

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,21 @@ environment, but it does sufficient testing by building samples and
1919
tests for different boards and different configurations to help keep the
2020
full code tree buildable.
2121

22+
When using (at least) one ``-v`` option, sanitycheck's console output
23+
shows for every test how the test is run (qemu, native_posix, etc.) or
24+
whether the image is just built. There are a few reasons why sanitycheck
25+
only builds a test and doesn't run it:
26+
27+
- The test is marked as ``build_only: true`` in its ``.yaml``
28+
configuration file.
29+
- The test configuration has defined a ``harness`` but you don't have
30+
it or haven't set it up.
31+
- You or some higher level automation invoked sanitycheck with
32+
``--build-only``.
33+
34+
These also affect the outputs of ``--testcase-report`` and
35+
``--detailed-report``, see their respective ``--help`` sections.
36+
2237
To run the script in the local tree, follow the steps below:
2338

2439
::
@@ -38,7 +53,8 @@ a simulated (QEMU) environment.
3853

3954
The sanitycheck script accepts the following optional arguments:
4055

41-
-h, --help show this help message and exit
56+
-h, --help Show the complete and most up-to-date help message
57+
and exit.
4258
-p PLATFORM, --platform PLATFORM
4359
Platform filter for testing. This option may be used
4460
multiple times. Testcases will only be built/run on
@@ -349,7 +365,7 @@ extra_configs: <list of extra configurations>
349365

350366

351367
build_only: <True|False> (default False)
352-
If true, don't try to run the test under QEMU even if the
368+
If true, don't try to run the test even if the
353369
selected platform supports it.
354370

355371
build_on_all: <True|False> (default False)

scripts/sanitycheck

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# SPDX-License-Identifier: Apache-2.0
44
"""Zephyr Sanity Tests
55
6+
Also check the "User and Developer Guides" at https://docs.zephyrproject.org/
7+
68
This script scans for the set of unit test applications in the git
79
repository and attempts to execute them. By default, it tries to
810
build each test case on one platform per architecture, using a precedence
@@ -42,8 +44,8 @@ pairs:
4244
when building or running the test case.
4345
4446
build_only: <True|False> (default False)
45-
If true, don't try to run the test under QEMU even if the
46-
selected platform supports it.
47+
If true, don't try to run the test even if the selected platform
48+
supports it.
4749
4850
build_on_all: <True|False> (default False)
4951
If true, attempt to build test on all available platforms.
@@ -2723,8 +2725,8 @@ def parse_arguments():
27232725
"""
27242726
Artificially long but functional example:
27252727
$ ./scripts/sanitycheck -v \\
2726-
--testcase-root tests/ \\
2727-
--testcase-root mytests/ \\
2728+
--testcase-root tests/ztest/base \\
2729+
--testcase-root tests/kernel \\
27282730
--test tests/ztest/base/testing.ztest.verbose_0 \\
27292731
--test tests/kernel/fifo/fifo_api/kernel.fifo.poll
27302732
@@ -2776,7 +2778,7 @@ Artificially long but functional example:
27762778
test_xor_subtest.add_argument(
27772779
"-s", "--test", action="append",
27782780
help="Run only the specified test cases. These are named by "
2779-
"path/relative/to/Zephyr/base/section.name.in.testcase.yaml>")
2781+
"<path/relative/to/Zephyr/base/section.name.in.testcase.yaml>")
27802782

27812783
test_xor_subtest.add_argument(
27822784
"--sub-test", action="append",
@@ -2794,7 +2796,9 @@ Artificially long but functional example:
27942796

27952797
parser.add_argument(
27962798
"-o", "--testcase-report",
2797-
help="Output a CSV spreadsheet containing results of the test run")
2799+
help="""Output a CSV spreadsheet containing results of the test run.
2800+
The handler_time column is left blank for tests that were only
2801+
compiled and not run.""")
27982802
parser.add_argument(
27992803
"-d", "--discard-report",
28002804
help="Output a CSV spreadsheet showing tests that were skipped "
@@ -2844,7 +2848,11 @@ Artificially long but functional example:
28442848
parser.add_argument("--detailed-report",
28452849
action="store",
28462850
metavar="FILENAME",
2847-
help="Generate a junit report with detailed testcase results.")
2851+
help="""Generate a junit report with detailed testcase results.
2852+
Unlike the CSV file produced by --testcase-report, this XML
2853+
report includes only tests which have run and none which were
2854+
merely built. If an image with multiple tests crashes early then
2855+
later tests are not accounted for either.""")
28482856

28492857
parser.add_argument("--timestamps",
28502858
action="store_true",

0 commit comments

Comments
 (0)