Skip to content

Commit 932a33a

Browse files
marc-hbandrewboie
authored andcommitted
sanitycheck: fix, expand and clarify test case selection --help
- Fix wrong --test help message - Provide more examples to clarify naming hierarchy - Document that --sub-test runs its entire --test - Point out that save/load options use their own format - Document that --list-tests is flattened Signed-off-by: Marc Herbert <[email protected]>
1 parent 56ec1d8 commit 932a33a

File tree

1 file changed

+30
-11
lines changed

1 file changed

+30
-11
lines changed

scripts/sanitycheck

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2649,7 +2649,18 @@ def parse_arguments():
26492649
formatter_class=argparse.RawDescriptionHelpFormatter)
26502650
parser.fromfile_prefix_chars = "+"
26512651

2652-
case_select = parser.add_argument_group("Test case selection")
2652+
case_select = parser.add_argument_group("Test case selection",
2653+
"""
2654+
Artificially long but functional example:
2655+
$ ./scripts/sanitycheck -v \\
2656+
--testcase-root tests/ \\
2657+
--testcase-root mytests/ \\
2658+
--test tests/ztest/base/testing.ztest.verbose_0 \\
2659+
--test tests/kernel/fifo/fifo_api/kernel.fifo.poll
2660+
2661+
"kernel.fifo.poll" is one of the test section names in
2662+
__/fifo_api/testcase.yaml
2663+
""")
26532664

26542665
parser.add_argument("--force-toolchain", action="store_true",
26552666
help="Do not filter based on toolchain, use the set "
@@ -2695,14 +2706,16 @@ def parse_arguments():
26952706
test_xor_subtest.add_argument(
26962707
"-s", "--test", action="append",
26972708
help="Run only the specified test cases. These are named by "
2698-
"<path to test project relative to "
2699-
"--testcase-root>/<testcase.yaml section name>")
2709+
"path/relative/to/Zephyr/base/section.name.in.testcase.yaml>")
27002710

27012711
test_xor_subtest.add_argument(
27022712
"--sub-test", action="append",
2703-
help="Run only the specified sub-test cases and its parent. These are named by "
2704-
"test case name appended by test function, i.e. kernel.mutex.mutex_lock_unlock."
2705-
)
2713+
help="""Recursively find sub-test functions and run the entire
2714+
test section where they were found, including all sibling test
2715+
functions. Sub-tests are named by:
2716+
section.name.in.testcase.yaml.function_name_without_test_prefix
2717+
Example: kernel.fifo.poll.fifo_loop
2718+
""")
27062719

27072720
parser.add_argument(
27082721
"-l", "--all", action="store_true",
@@ -2740,7 +2753,13 @@ def parse_arguments():
27402753
help="list all tags in selected tests")
27412754

27422755
case_select.add_argument("--list-tests", action="store_true",
2743-
help="list all tests.")
2756+
help="""List of all sub-test functions recursively found in
2757+
all --testcase-root arguments. Note different sub-tests can share
2758+
the same section name and come from different directories.
2759+
The output is flattened and reports --sub-test names only,
2760+
not their directories. For instance net.socket.getaddrinfo_ok
2761+
and net.socket.fd_set belong to different directories.
2762+
""")
27442763

27452764
parser.add_argument("--export-tests", action="store",
27462765
metavar="FILENAME",
@@ -2788,14 +2807,14 @@ def parse_arguments():
27882807
"--load-tests",
27892808
metavar="FILENAME",
27902809
action="store",
2791-
help="Load list of tests to be run from file.")
2810+
help="Load list of tests and platforms to be run from file.")
27922811

27932812
case_select.add_argument(
27942813
"-E",
27952814
"--save-tests",
27962815
metavar="FILENAME",
27972816
action="store",
2798-
help="Save list of tests to be run to file.")
2817+
help="Save list of tests and platforms to be run to file.")
27992818

28002819
parser.add_argument(
28012820
"-b", "--build-only", action="store_true",
@@ -2844,8 +2863,8 @@ def parse_arguments():
28442863
"-T", "--testcase-root", action="append", default=[],
28452864
help="Base directory to recursively search for test cases. All "
28462865
"testcase.yaml files under here will be processed. May be "
2847-
"called multiple times. Defaults to the 'samples' and "
2848-
"'tests' directories in the Zephyr tree.")
2866+
"called multiple times. Defaults to the 'samples/' and "
2867+
"'tests/' directories at the base of the Zephyr tree.")
28492868

28502869
board_root_list = ["%s/boards" % ZEPHYR_BASE,
28512870
"%s/scripts/sanity_chk/boards" % ZEPHYR_BASE]

0 commit comments

Comments
 (0)