Skip to contentSkip to conversation

Documentation: kunit: remove duplicate kunit-tool.rst

PATCH In review Daniel Latypov 3 participants 11 messages Jun 3, 2022 – Jun 29, 2022

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

PATCH 1/3 Documentation: kunit: remove duplicate kunit-tool.rst

The information is duplicated now in run_wrapper.rst, which was added in commit 46201d47d6c4 ("Documentation: kunit: Reorganize documentation related to running tests").

You cna compare these pages here:
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/run_wrapper.html
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/kunit-tool.html

We should have deleted it in then but it got overlooked.

---
 Documentation/dev-tools/kunit/index.rst      |   3 -
 Documentation/dev-tools/kunit/kunit-tool.rst | 232 -------------------
 Documentation/dev-tools/kunit/start.rst      |   2 -
 3 files changed, 237 deletions(-)
 delete mode 100644 Documentation/dev-tools/kunit/kunit-tool.rst
Documentation/dev-tools/kunit/index.rst +0 -3
index 595205348d2d..84a87c57c7e8 100644
@@ -13,7 +13,6 @@ KUnit - Linux Kernel Unit Testing
 	run_wrapper
 	run_manual
 	usage
-	kunit-tool
 	api/index
 	style
 	faq
@@ -107,7 +106,5 @@ How do I use it?
     examples.
 *   Documentation/dev-tools/kunit/api/index.rst - KUnit APIs
     used for testing.
-*   Documentation/dev-tools/kunit/kunit-tool.rst - kunit_tool helper
-    script.
 *   Documentation/dev-tools/kunit/faq.rst - KUnit common questions and
     answers.
Documentation/dev-tools/kunit/kunit-tool.rst deleted +0 -232

232 lines not on this page · raw message

Documentation/dev-tools/kunit/start.rst +0 -2
index 867a4bba6bf6..e730df1f468e 100644
@@ -254,7 +254,5 @@ Next Steps
     examples.
 *   Documentation/dev-tools/kunit/api/index.rst - KUnit APIs
     used for testing.
-*   Documentation/dev-tools/kunit/kunit-tool.rst - kunit_tool helper
-    script.
 *   Documentation/dev-tools/kunit/faq.rst - KUnit common questions and
     answers.

base-commit: 50fd82b3a9a9335df5d50c7ddcb81c81d358c4fc

Signature · 1 line
2.36.1.255.ge46751e96f-goog
#1 lore raw

PATCH 2/3 Documentation: kunit: move mention of --jobs flag lower

Commit ad659ccb5412 ("kunit: tool: Default --jobs to number of CPUs") changed the --jobs flag from a hard-coded value of 8 to basically nproc.

Therefore, most users should probably not need to bother to tweak this flag. Having it near the top of the page is more noise than anything.

---
 Documentation/dev-tools/kunit/run_wrapper.rst | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
Documentation/dev-tools/kunit/run_wrapper.rst +4 -2
index 653985ce9cae..1fccf2e099f7 100644
@@ -30,10 +30,9 @@ We may want to use the following options:
 
 .. code-block::
 
-	./tools/testing/kunit/kunit.py run --timeout=30 --jobs=`nproc --all
+	./tools/testing/kunit/kunit.py run --timeout=30
 
 - ``--timeout`` sets a maximum amount of time for tests to run.
-- ``--jobs`` sets the number of threads to build the kernel.
 
 kunit_tool will generate a ``.kunitconfig`` with a default
 configuration, if no other ``.kunitconfig`` file exists
@@ -237,6 +236,9 @@ command line arguments:
   compiling a kernel (using ``build`` or ``run`` commands). For example:
   to enable compiler warnings, we can pass ``--make_options W=1``.
 
+- ``--jobs``: The ``-j`` argument to ``make`` when building the kernel.
+  Defaults to the same value as ``nproc``.
+
 - ``--alltests``: Builds a UML kernel with all config options enabled
   using ``make allyesconfig``. This allows us to run as many tests as
   possible.
Signature · 1 line
2.36.1.255.ge46751e96f-goog
#2 lore raw

PATCH 3/3 Documentation: kunit: rewrite section on .kunitconfig

In reply to Daniel Latypov

This section was slightly out of date and redundant.
* the note was obsolete since commit 4c2911f1e140 ("kunit: tool:
reconfigure when the used kunitconfig changes")
* we don't want users to grab the default config manually, running kunit.py config/build/run will do that for them as noted in the section above.

This rewrite tries to pull back the curtain and show that .kunitconfig isn't magic by giving some example commands a user can run to emulate kunit.py.

---
 Documentation/dev-tools/kunit/run_wrapper.rst | 47 +++++++------------
 1 file changed, 17 insertions(+), 30 deletions(-)
Documentation/dev-tools/kunit/run_wrapper.rst +17 -30
index 1fccf2e099f7..e0ddd18f8c2e 100644
@@ -57,45 +57,32 @@ To view kunit_tool flags (optional command-line arguments), run:
 
 	./tools/testing/kunit/kunit.py run --help
 
-Create a  ``.kunitconfig`` File
-===============================
-
-If we want to run a specific set of tests (rather than those listed
-in the KUnit ``defconfig``), we can provide Kconfig options in the
-``.kunitconfig`` file. For default .kunitconfig, see:
-https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/tools/testing/kunit/configs/default.config.
-A ``.kunitconfig`` is a ``minconfig`` (a .config
-generated by running ``make savedefconfig``), used for running a
-specific set of tests. This file contains the regular Kernel configs
-with specific test targets. The ``.kunitconfig`` also
-contains any other config options required by the tests (For example:
-dependencies for features under tests, configs that enable/disable
-certain code blocks, arch configs and so on).
+.kunitconfig
+============
 
-To create a ``.kunitconfig``, using the KUnit ``defconfig``:
+We mentioned it above, but a ``.kunitconfig`` is a *minconfig*, i.e. you only
+need to specify the options you care about, e.g.
 
 .. code-block::
 
-	cd $PATH_TO_LINUX_REPO
-	cp tools/testing/kunit/configs/default.config .kunit/.kunitconfig
+	CONFIG_KUNIT=y
+	CONFIG_KUNIT_EXAMPLE_TEST=y
 
-We can then add any other Kconfig options. For example:
+Concretely, here's more or less what ``kunit.py run`` does by default:
 
-.. code-block::
+.. code-block:: bash
 
-	CONFIG_LIST_KUNIT_TEST=y
+   $ cp $KUNITCONFIG .kunit/.config
+   $ make O=.kunit ARCH=um olddefconfig
+   $ make O=.kunit ARCH=um -j `nproc`
+   $ .kunit/linux </dev/null 2>&1 | ./tools/testing/kunit/kunit.py parse
 
-kunit_tool ensures that all config options in ``.kunitconfig`` are
-set in the kernel ``.config`` before running the tests. It warns if we
-have not included the options dependencies.
+See `Parse Test Results`_ for more details about ``kunit.py parse``.
 
-.. note:: Removing something from the ``.kunitconfig`` will
-   not rebuild the ``.config file``. The configuration is only
-   updated if the ``.kunitconfig`` is not a subset of ``.config``.
-   This means that we can use other tools
-   (For example: ``make menuconfig``) to adjust other config options.
-   The build dir needs to be set for ``make menuconfig`` to
-   work, therefore  by default use ``make O=.kunit menuconfig``.
+  .. note:: Note: ``make olddefconfig`` will drop ``CONFIG`` options that aren't visible
+            (e.g. are inside an unsatisfied ``if`` block) or have missing dependencies.
+            kunit.py will validate every option in ``$KUNITCONFIG`` is present in the final
+            ``.config``, so it should be safer and less error-prone than doing this manually.
 
 Configure, Build, and Run Tests
 ===============================
Signature · 1 line
2.36.1.255.ge46751e96f-goog
maintainer
#3 lore raw
In reply to Daniel Latypov
Quoted 11 lines · Daniel Latypov

The information is duplicated now in run_wrapper.rst, which was added in commit 46201d47d6c4 ("Documentation: kunit: Reorganize documentation related to running tests").

You cna compare these pages here:
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/run_wrapper.html
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/kunit-tool.html

We should have deleted it in then but it got overlooked.

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

Thanks,

jon

#4 lore raw
Quoted 11 lines · Jonathan Corbet
Quoted 8 lines · Daniel Latypov

The information is duplicated now in run_wrapper.rst, which was added in commit 46201d47d6c4 ("Documentation: kunit: Reorganize documentation related to running tests").

You cna compare these pages here:
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/run_wrapper.html
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/kunit-tool.html

Quoted 7 lines
Quoted 3 lines

We should have deleted it in then but it got overlooked.

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

Thanks!

Tbh, I'm not really sure what the status is either.
I saw that 46201d47d6c4 (which added the duplication) went through the docs tree, so I followed suit for this.

I've been guilty of sending purely doc patches through Shuah/-kselftest tree before, but that was mostly when there were code change dependencies.

If it makes it simpler, we could try and agree that all kunit doc patches go through Shuah going forward?
Shuah, Bredan: thoughts/opinions?

Daniel

reviewer
#5 lore raw
In reply to Jonathan Corbet
Quoted 10 lines · Jonathan Corbet
Quoted 8 lines · Daniel Latypov

The information is duplicated now in run_wrapper.rst, which was added in commit 46201d47d6c4 ("Documentation: kunit: Reorganize documentation related to running tests").

You cna compare these pages here:
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/run_wrapper.html
https://www.kernel.org/doc/html/v5.18/dev-tools/kunit/kunit-tool.html

Quoted 8 lines
Quoted 3 lines

We should have deleted it in then but it got overlooked.

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

I am still taking ksefltest and kunit doc patches through my tree. I wait for Brendan to ack at times. This one didn't show up in linux-kselftest list it appears.

If you cc linux-kselftest and I get an ack from Brendan, I will take this through kselftest tree.

thanks,
-- Shuah

maintainer
#6 lore raw
Quoted 11 lines · Shuah Khan
Quoted 4 lines

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

I am still taking ksefltest and kunit doc patches through my tree. I wait for Brendan to ack at times. This one didn't show up in linux-kselftest list it appears.

If you cc linux-kselftest and I get an ack from Brendan, I will take this through kselftest tree.

As I said up above, I went ahead and applied them. I can drop them again if you want to carry them, just let me know.

Thanks,

jon

reviewer
#7 lore raw
Quoted 11 lines · Jonathan Corbet
Quoted 9 lines · Shuah Khan
Quoted 4 lines

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

I am still taking ksefltest and kunit doc patches through my tree. I wait for Brendan to ack at times. This one didn't show up in linux-kselftest list it appears.

Quoted 6 lines
Quoted 2 lines

If you cc linux-kselftest and I get an ack from Brendan, I will take this through kselftest tree.

As I said up above, I went ahead and applied them. I can drop them again if you want to carry them, just let me know.

Jon, yes please go ahead and drop this one. I will wait for Brendan to ack it. Reduces confusion in the future. Very often, there is code dependencies as well.

Daniel, please don't skip kselftest list in the future.

thanks,
-- Shuah

#8 lore raw
Quoted 20 lines · Shuah Khan
Quoted 11 lines · Jonathan Corbet
Quoted 9 lines · Shuah Khan
Quoted 4 lines

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

I am still taking ksefltest and kunit doc patches through my tree. I wait for Brendan to ack at times. This one didn't show up in linux-kselftest list it appears.

Quoted 6 lines
Quoted 2 lines

If you cc linux-kselftest and I get an ack from Brendan, I will take this through kselftest tree.

As I said up above, I went ahead and applied them. I can drop them again if you want to carry them, just let me know.

Quoted 5 lines

Jon, yes please go ahead and drop this one. I will wait for Brendan to ack it. Reduces confusion in the future. Very often, there is code dependencies as well.

Daniel, please don't skip kselftest list in the future.

Ack.
I was hoping to avoid confusion about who should apply them; looks like it created more.

Just a note: this one has no code dependencies, so it can be applied whenever or wherever.

Daniel

maintainer
#9 lore raw
In reply to Shuah Khan
Quoted 15 lines · Shuah Khan
Quoted 14 lines · Jonathan Corbet
Quoted 11 lines · Shuah Khan
Quoted 4 lines

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

I am still taking ksefltest and kunit doc patches through my tree. I wait for Brendan to ack at times. This one didn't show up in linux-kselftest list it appears.

If you cc linux-kselftest and I get an ack from Brendan, I will take this through kselftest tree.

Quoted 7 lines
Quoted 3 lines

As I said up above, I went ahead and applied them. I can drop them again if you want to carry them, just let me know.

Jon, yes please go ahead and drop this one. I will wait for Brendan to ack it. Reduces confusion in the future. Very often, there is code dependencies as well.

OK, I have dropped those three commits. Note that I also had to drop Randy's patch which had been waiting since April:

https://lore.kernel.org/linux-doc/20220401024707.10550-1-rdunlap%40infradead.org/

since it conflicts with the above. So you'll want to pick that one up too.

Thanks,

jon

reviewer
#10 lore raw
Quoted 25 lines · Jonathan Corbet
Quoted 15 lines · Shuah Khan
Quoted 14 lines · Jonathan Corbet
Quoted 11 lines · Shuah Khan
Quoted 4 lines

So not that long ago these patches were going through Shuah...it seems that's not happening anymore? I can pick up kunit docs patches, certainly. I've taken the silence on these as assent and applied them.

I am still taking ksefltest and kunit doc patches through my tree. I wait for Brendan to ack at times. This one didn't show up in linux-kselftest list it appears.

If you cc linux-kselftest and I get an ack from Brendan, I will take this through kselftest tree.

Quoted 7 lines
Quoted 3 lines

As I said up above, I went ahead and applied them. I can drop them again if you want to carry them, just let me know.

Jon, yes please go ahead and drop this one. I will wait for Brendan to ack it. Reduces confusion in the future. Very often, there is code dependencies as well.

Quoted 8 lines

OK, I have dropped those three commits. Note that I also had to drop Randy's patch which had been waiting since April:

   https://lore.kernel.org/linux-doc/20220401024707.10550-1-rdunlap%40infradead.org/

since it conflicts with the above. So you'll want to pick that one up too.

Thank you. I will pick these 3 up.

thanks,
-- Shuah