From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-6.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 6D7887D90F for ; Mon, 23 Sep 2019 21:19:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389208AbfIWVSu (ORCPT ); Mon, 23 Sep 2019 17:18:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:47720 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387437AbfIWVSu (ORCPT ); Mon, 23 Sep 2019 17:18:50 -0400 Received: from [192.168.1.112] (c-24-9-64-241.hsd1.co.comcast.net [24.9.64.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id DEFE921655; Mon, 23 Sep 2019 21:18:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1569273528; bh=uZGy9vlY/pn+dPb1iZcKXB9oWJ1CxU/IxDEL/lnY++Y=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=SGo9W/cpUNl7KLgBfpJognPZxmFKKR4dEP6cA4jJHfYUQWpe3l2mgKE4k6iQx35cy ofpQ0Ztxh76B0jNkARdk9GCqGBkkj5Tzt6rUZCw261tq2nb9i+caRKzISInhCp2Dgx eN+urP1l4CUPMZHARnlboLegMC/L9Vk8rfBD2WVE= Subject: Re: [PATCH v18 15/19] Documentation: kunit: add documentation for KUnit To: Randy Dunlap , Brendan Higgins Cc: Frank Rowand , Greg KH , Josh Poimboeuf , Kees Cook , Kieran Bingham , Luis Chamberlain , Peter Zijlstra , Rob Herring , Stephen Boyd , Theodore Ts'o , Masahiro Yamada , devicetree , dri-devel , kunit-dev@googlegroups.com, "open list:DOCUMENTATION" , linux-fsdevel@vger.kernel.org, linux-kbuild , Linux Kernel Mailing List , "open list:KERNEL SELFTEST FRAMEWORK" , linux-nvdimm , linux-um@lists.infradead.org, Sasha Levin , "Bird, Timothy" , Amir Goldstein , Dan Carpenter , Daniel Vetter , Jeff Dike , Joel Stanley , Julia Lawall , Kevin Hilman , Knut Omang , Logan Gunthorpe , Michael Ellerman , Petr Mladek , Richard Weinberger , David Rientjes , Steven Rostedt , wfg@linux.intel.com, Linus Torvalds , Felix Guo , Jonathan Corbet , shuah References: <20190923090249.127984-1-brendanhiggins@google.com> <20190923090249.127984-16-brendanhiggins@google.com> From: shuah Message-ID: Date: Mon, 23 Sep 2019 15:18:33 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 9/23/19 1:49 PM, Randy Dunlap wrote: > On 9/23/19 11:06 AM, Brendan Higgins wrote: >> On Mon, Sep 23, 2019 at 8:48 AM Randy Dunlap wrote: >>> >>> On 9/23/19 2:02 AM, Brendan Higgins wrote: >>>> Add documentation for KUnit, the Linux kernel unit testing framework. >>>> - Add intro and usage guide for KUnit >>>> - Add API reference >>>> >>>> Signed-off-by: Felix Guo >>>> Signed-off-by: Brendan Higgins >>>> Cc: Jonathan Corbet >>>> Reviewed-by: Greg Kroah-Hartman >>>> Reviewed-by: Logan Gunthorpe >>>> Reviewed-by: Stephen Boyd >>>> --- >>>> Documentation/dev-tools/index.rst | 1 + >>>> Documentation/dev-tools/kunit/api/index.rst | 16 + >>>> Documentation/dev-tools/kunit/api/test.rst | 11 + >>>> Documentation/dev-tools/kunit/faq.rst | 62 +++ >>>> Documentation/dev-tools/kunit/index.rst | 79 +++ >>>> Documentation/dev-tools/kunit/start.rst | 180 ++++++ >>>> Documentation/dev-tools/kunit/usage.rst | 576 ++++++++++++++++++++ >>>> 7 files changed, 925 insertions(+) >>>> create mode 100644 Documentation/dev-tools/kunit/api/index.rst >>>> create mode 100644 Documentation/dev-tools/kunit/api/test.rst >>>> create mode 100644 Documentation/dev-tools/kunit/faq.rst >>>> create mode 100644 Documentation/dev-tools/kunit/index.rst >>>> create mode 100644 Documentation/dev-tools/kunit/start.rst >>>> create mode 100644 Documentation/dev-tools/kunit/usage.rst >>> >>> >>>> diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst >>>> new file mode 100644 >>>> index 000000000000..6dc229e46bb3 >>>> --- /dev/null >>>> +++ b/Documentation/dev-tools/kunit/start.rst >>>> @@ -0,0 +1,180 @@ >>>> +.. SPDX-License-Identifier: GPL-2.0 >>>> + >>>> +=============== >>>> +Getting Started >>>> +=============== >>>> + >>>> +Installing dependencies >>>> +======================= >>>> +KUnit has the same dependencies as the Linux kernel. As long as you can build >>>> +the kernel, you can run KUnit. >>>> + >>>> +KUnit Wrapper >>>> +============= >>>> +Included with KUnit is a simple Python wrapper that helps format the output to >>>> +easily use and read KUnit output. It handles building and running the kernel, as >>>> +well as formatting the output. >>>> + >>>> +The wrapper can be run with: >>>> + >>>> +.. code-block:: bash >>>> + >>>> + ./tools/testing/kunit/kunit.py run >>>> + >>>> +Creating a kunitconfig >>>> +====================== >>>> +The Python script is a thin wrapper around Kbuild as such, it needs to be >>> >>> around Kbuild. As such, >> >> Thanks for pointing this out. >> >>> >>>> +configured with a ``kunitconfig`` file. This file essentially contains the >>>> +regular Kernel config, with the specific test targets as well. >>>> + >>>> +.. code-block:: bash >>>> + >>>> + git clone -b master https://kunit.googlesource.com/kunitconfig $PATH_TO_KUNITCONFIG_REPO >>>> + cd $PATH_TO_LINUX_REPO >>>> + ln -s $PATH_TO_KUNIT_CONFIG_REPO/kunitconfig kunitconfig >>>> + >>>> +You may want to add kunitconfig to your local gitignore. >>>> + >>>> +Verifying KUnit Works >>>> +--------------------- >>>> + >>>> +To make sure that everything is set up correctly, simply invoke the Python >>>> +wrapper from your kernel repo: >>>> + >>>> +.. code-block:: bash >>>> + >>>> + ./tools/testing/kunit/kunit.py >>>> + >>>> +.. note:: >>>> + You may want to run ``make mrproper`` first. >>> >>> I normally use O=builddir when building kernels. >>> Does this support using O=builddir ? >> >> Yep, it supports specifying a separate build directory. >> >>>> + >>>> +If everything worked correctly, you should see the following: >>>> + >>>> +.. code-block:: bash >>>> + >>>> + Generating .config ... >>>> + Building KUnit Kernel ... >>>> + Starting KUnit Kernel ... >>>> + >>>> +followed by a list of tests that are run. All of them should be passing. >>>> + >>>> +.. note:: >>>> + Because it is building a lot of sources for the first time, the ``Building >>>> + kunit kernel`` step may take a while. >>>> + >>>> +Writing your first test >>>> +======================= >>> >>> [snip] >>> >>>> diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-tools/kunit/usage.rst >>>> new file mode 100644 >>>> index 000000000000..c6e69634e274 >>>> --- /dev/null >>>> +++ b/Documentation/dev-tools/kunit/usage.rst >>> >>> TBD... >> >> What did you mean by this comment? > > I plan to review usage.rst soon... (To Be Done :) > I would like to apply the series very soon so it gets some soak time after this move in linux-next and it can still make the rc1. Since there changes can be addressed after rc1, I would like to not require Brendan to do another version before I apply. Hope you are okay with that Randy! thanks, -- Shuah