From mboxrd@z Thu Jan 1 00:00:00 1970 From: Randy Dunlap Subject: Re: [PATCH v18 15/19] Documentation: kunit: add documentation for KUnit Date: Mon, 23 Sep 2019 08:47:53 -0700 Message-ID: References: <20190923090249.127984-1-brendanhiggins@google.com> <20190923090249.127984-16-brendanhiggins@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20190923090249.127984-16-brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org> Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-nvdimm-bounces-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org Sender: "Linux-nvdimm" To: Brendan Higgins , frowand.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, jpoimboe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, keescook-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, kieran.bingham-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org, mcgrof-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, sboyd-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, shuah-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, tytso-3s7WtUTddSA@public.gmane.org, yamada.masahiro-uWyLwvC0a2jby3iVrkZq2A@public.gmane.org Cc: pmladek-IBi9RG/b67k@public.gmane.org, linux-doc-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, amir73il-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org, Alexander.Levin-0li6OtcxBFHby3iVrkZq2A@public.gmane.org, linux-kselftest-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org, khilman-rdvid1DuHRBWk0Htik3J/w@public.gmane.org, knut.omang-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org, Felix Guo , wfg-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, joel-U3u1mxZcP9KHXe+LvDLADg@public.gmane.org, rientjes-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, jdike-OPE4K8JWMJJBDgjK7y7TUQ@public.gmane.org, dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-kbuild-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Tim.Bird-7U/KSKJipcs@public.gmane.org, linux-um-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, rostedt-nx8X9YLhiw1AfugRpC6u6w@public.gmane.org, julia.lawall-L2FTfq7BK8M@public.gmane.org, kunit-dev-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, richard-/L3Ra7n9ekc@public.gmane.org, torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, Jonathan Corbet , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, daniel-/w4YWyX8dFk@public.gmane.org, mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org, linux-fsdevel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: devicetree@vger.kernel.org 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, > +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 ? > + > +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... -- ~Randy