Skip to contentSkip to conversation

Documentation: kunit: Clarify test filter format

PATCH In review Brendan Jackman 3 participants 4 messages Apr 2, 2024 – May 14, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Documentation: kunit: Clarify test filter format

It seems obvious once you know, but at first I didn't realise that the suite name is part of this format. Document it and add some examples.

---
v1->v2: Expanded to clarify that suite_glob and test_glob are two separate
patterns. Also made some other trivial changes to formatting etc.

 Documentation/dev-tools/kunit/run_wrapper.rst | 33 +++++++++++++++++--
 1 file changed, 30 insertions(+), 3 deletions(-)
Documentation/dev-tools/kunit/run_wrapper.rst +30 -3
index 19ddf5e07013..b07252d3fa9d 100644
@@ -156,12 +156,39 @@ Filtering tests
 ===============
 
 By passing a bash style glob filter to the ``exec`` or ``run``
-commands, we can run a subset of the tests built into a kernel . For
-example: if we only want to run KUnit resource tests, use:
+commands, we can run a subset of the tests built into a kernel,
+identified by a string like ``<suite_glob>[.<test_glob>]``.
+
+For example, to run the ``kunit-resource-test`` suite:
+
+.. code-block::
+
+	./tools/testing/kunit/kunit.py run kunit-resource-test
+
+To run a specific test from that suite:
+
+.. code-block::
+
+	./tools/testing/kunit/kunit.py run kunit-resource-test.kunit_resource_test
+
+To run all tests from suites whose names start with ``kunit``:
+
+.. code-block::
+
+	./tools/testing/kunit/kunit.py run 'kunit*'
+
+To run all tests whose name ends with ``remove_resource``:
+
+.. code-block::
+
+	./tools/testing/kunit/kunit.py run '*.*remove_resource'
+
+To run all tests whose name ends with ``remove_resource``, from suites whose
+names start with ``kunit``:
 
 .. code-block::
 
-	./tools/testing/kunit/kunit.py run 'kunit-resource*'
+	./tools/testing/kunit/kunit.py run 'kunit*.*remove_resource'
 
 This uses the standard glob format with wildcard characters.
 
Signature · 1 line
2.44.0.478.gd926399ef9-goog
Reviewed-by on v2 1/1
#1 lore raw
Quoted 5 lines · Brendan Jackman

It seems obvious once you know, but at first I didn't realise that the suite name is part of this format. Document it and add some examples.

Thanks!

I agree with your comment on v1, I think the extra verbosity is fine. It's still easy to read and this should hopefully eliminate the ambiguity for most readers.

Quoted 3 lines

---
v1->v2: Expanded to clarify that suite_glob and test_glob are two separate
patterns. Also made some other trivial changes to formatting etc.

<snip>

maintainer
#3 lore raw
Quoted 4 lines · Brendan Jackman
Quoted 1 line · Daniel Latypov

Hi Jonathan, I think this is ready to be applied?

I'm happy to take this, but normally these patches go through the kunit tree, so I've not been paying much attention. Let me know please if I should pick it up.

Thanks,

jon