Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8354ACCA47C for ; Fri, 3 Jun 2022 19:57:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349348AbiFCT5q (ORCPT ); Fri, 3 Jun 2022 15:57:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52640 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348129AbiFCT5q (ORCPT ); Fri, 3 Jun 2022 15:57:46 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4741EEDA for ; Fri, 3 Jun 2022 12:57:44 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-310061f47faso32684657b3.9 for ; Fri, 03 Jun 2022 12:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=+0BJkP7LQA7GM1MPeGO3z/t5dz9swoXFRqhRmsZFFPo=; b=XgqsCrfxLrG3S04UfcYNJfVoH5ccnQjNtz4xJnA0tnNYj8f3CmKGcspLcmL9hzGQkN zOLnmRdyHyyR36jS7Osm5HwK09Ft3Ql4i9E/JnNdaTh+V/bcWCMhFSK1feT/tqnw1AE6 76DCh1hY0Q36NB4nLsVDbBIrKkI0lyuVbktdsxtLAIlHDziorFLtHlrbjC8M13/wC2nP 4BlN0e57iMF3pO47ug5R6MOZGMO0SdwLiPCNcpskuEmOryKg6XnqA9U4oNPHgvqYJXA5 0SJR8CQneq6FyS7nADbHPFJsILTJsrs8J7S5SjE/3CoQtn3CdV+BE+JL0v+OQb6efoLk ynOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=+0BJkP7LQA7GM1MPeGO3z/t5dz9swoXFRqhRmsZFFPo=; b=kSNSmjPlmmsl6ISbN2UfRDSKgO0CM2yCO9DsrlLKiW88p05/VYldEKmaVIAVbqHhrD jYGIXskzRitq8dm8BO+ZUCePAXlxDIuxWNELcRuzmXh/CLWbBs/HjtUPxi1xzPJoZ7I8 fiZXpA+SNLNO0lLD2wt7Aozj9BfI4LM4AIEZWiMOtDH3i95q4EsMtrACyqtd04HY/LBy 7pA4C1B3YxInvlMyfJi2slHf/1gFEIk/3NQCMOvlfH9MY7qGJZvfvQZ10cGpHq5fGWQV eRsrREf1TooUUw6xJD1//9x6BvSSel6V9FUvwMzOcWThLoL0GrEv11s5ILw83tJLu9+6 g6Tw== X-Gm-Message-State: AOAM532Ei4gSstObGF3OmKHmVRfuzGDdBKYDplc+K1/VMy+CZQEpqzWw 6zvVhvSNtkdWUFXSB4cMmHciOvyk5bpJ4w== X-Google-Smtp-Source: ABdhPJwHQHGSl3m9zUFvEI3sbSQwNUh2f2XGX55AQDH0UH+u9m6F6gc6Zk1TgV+GsgfajBktCzXA3OPsTcHVwg== X-Received: from dlatypov.svl.corp.google.com ([2620:15c:2cd:202:9ff0:c6ec:46df:8f8a]) (user=dlatypov job=sendgmr) by 2002:a25:9cc5:0:b0:65c:c760:9e34 with SMTP id z5-20020a259cc5000000b0065cc7609e34mr12465282ybo.518.1654286264235; Fri, 03 Jun 2022 12:57:44 -0700 (PDT) Date: Fri, 3 Jun 2022 12:56:26 -0700 In-Reply-To: <20220603195626.121922-1-dlatypov@google.com> Message-Id: <20220603195626.121922-3-dlatypov@google.com> Mime-Version: 1.0 References: <20220603195626.121922-1-dlatypov@google.com> X-Mailer: git-send-email 2.36.1.255.ge46751e96f-goog Subject: [PATCH 3/3] Documentation: kunit: rewrite section on .kunitconfig From: Daniel Latypov 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 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org 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 --- 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 &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