All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Latypov <dlatypov@google.com>
To: brendanhiggins@google.com, davidgow@google.com
Cc: linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com,
	corbet@lwn.net, linux-doc@vger.kernel.org,
	Daniel Latypov <dlatypov@google.com>
Subject: [PATCH 3/3] Documentation: kunit: rewrite section on .kunitconfig
Date: Fri,  3 Jun 2022 12:56:26 -0700	[thread overview]
Message-ID: <20220603195626.121922-3-dlatypov@google.com> (raw)
In-Reply-To: <20220603195626.121922-1-dlatypov@google.com>

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.

Signed-off-by: Daniel Latypov <dlatypov@google.com>
---
 Documentation/dev-tools/kunit/run_wrapper.rst | 47 +++++++------------
 1 file changed, 17 insertions(+), 30 deletions(-)

diff --git a/Documentation/dev-tools/kunit/run_wrapper.rst b/Documentation/dev-tools/kunit/run_wrapper.rst
index 1fccf2e099f7..e0ddd18f8c2e 100644
--- a/Documentation/dev-tools/kunit/run_wrapper.rst
+++ b/Documentation/dev-tools/kunit/run_wrapper.rst
@@ -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
 ===============================
-- 
2.36.1.255.ge46751e96f-goog


  parent reply	other threads:[~2022-06-03 19:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 19:56 [PATCH 1/3] Documentation: kunit: remove duplicate kunit-tool.rst Daniel Latypov
2022-06-03 19:56 ` [PATCH 2/3] Documentation: kunit: move mention of --jobs flag lower Daniel Latypov
2022-06-03 19:56 ` Daniel Latypov [this message]
2022-06-24 19:47 ` [PATCH 1/3] Documentation: kunit: remove duplicate kunit-tool.rst Jonathan Corbet
2022-06-24 19:58   ` Daniel Latypov
2022-06-24 22:36   ` Shuah Khan
2022-06-24 22:43     ` Jonathan Corbet
2022-06-24 22:51       ` Shuah Khan
2022-06-24 23:40         ` Daniel Latypov
2022-06-27 22:28         ` Jonathan Corbet
2022-06-29 16:45           ` Shuah Khan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220603195626.121922-3-dlatypov@google.com \
    --to=dlatypov@google.com \
    --cc=brendanhiggins@google.com \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.