Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2183833ybc; Wed, 13 Nov 2019 10:14:12 -0800 (PST) X-Google-Smtp-Source: APXvYqzqSH8BHLzgrdaxUsZx2rpmv/ANvM42AmwF6zk7UhggCuffx7BISYSJJ/fWQv7H9leEyPxP X-Received: by 2002:a50:ec89:: with SMTP id e9mr5262054edr.104.1573668852006; Wed, 13 Nov 2019 10:14:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573668851; cv=none; d=google.com; s=arc-20160816; b=yJZUMOZ8FhiZWxhSwjWz0RUePfopvjkw5OyXCsaUtXzh+YKUAk2ydbkyrrP8WLzETQ X0skokxUghwT57ZAYOVzAgTjtOhqsqwOPrj2oohiThyBUqNliaMlVf+I9bmb4xyNEMhx cgq0TEkp2rtP0lNl9tZF5SUYQaLtNA6H0U3EUd6TKI7W9Z3Pb1jO2VNylEYiO8j2CzmJ hQ1MXA3GxMTo0ENPqKxgzLU+JqFDnXA5Cr7YwhOLs1sLBdOnikgLZhEEKFvfJtU49Gfm Li1w+HeGX31+GUWWTVy0yLZWdrWJZ7fORm6GN2puISVv1z0Jx4uNYIc448goshNPmb31 p9Vw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=ki25gnbpyN00Iv5cdTY8OhdgRYpiq6GuA0iUi2qS8JY=; b=uzImoKt2pa0JL/ibLbojeCUAtXrjVg9Ku8NzQBNBbxQIvt3HfJ9ij1Kvhji3+HB0eB x+66x5q7rdIulicdyeymY3Q+flrbKYLnN+3+p62pOr+Ztez1uCw9ju60ksFG3ANN3mF4 UEMd15G1PvrK27+mijagGeT6+07X3v5fewNahElN1eWUS3IdO3N+vpy/IbL1KE8VuXut 8iIgo8BsuGjL2UZEeftmDkyZh74VDmDCz7CZiyySDLLSkKlim2nO3yWWc0yvXOpStXGT hklQEu9Cehgx6FROXFGmBlHzc99C4CL/XmI6/tA4CYWA2C3H7i2Q6J6wafQfEO1swDMU N/tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Fs57GyBC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r2si1676682ejz.12.2019.11.13.10.13.47; Wed, 13 Nov 2019 10:14:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Fs57GyBC; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728228AbfKMSMo (ORCPT + 99 others); Wed, 13 Nov 2019 13:12:44 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:54678 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727112AbfKMSMn (ORCPT ); Wed, 13 Nov 2019 13:12:43 -0500 Received: by mail-wm1-f66.google.com with SMTP id z26so3008859wmi.4 for ; Wed, 13 Nov 2019 10:12:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ki25gnbpyN00Iv5cdTY8OhdgRYpiq6GuA0iUi2qS8JY=; b=Fs57GyBC4KqL9mwZ7pz4er+6yTwZnzeC3f6ecarogyGItcOt761IC74Ow/Fy4yemVK RUqp9/aQEupFLjbQgv1Is7jI9ME2ZM1Urs3WpBzkHiD8m8wVSpaj4qR2HT8NktQ9aIDh 83PGyCiMELKFkPAAJ4oKSoHJYw+BxXeDVZHwA+/1F1FsDEdMj437l2T1zBZvMvvheHvL fdLJ8urtUQhsyRrrfXAVw/DhaY2VeUzbmsUBTotErPCNPW/7n17mK4ajJuqRCwV0CKYj W+Zp1BcViOgwN1fFLrhobVuOpXFZhmczbXyYlTzP7butXBzzN7km9hK2nXnGXCXaobqM 5tig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ki25gnbpyN00Iv5cdTY8OhdgRYpiq6GuA0iUi2qS8JY=; b=eBxYaVGXFp0Ftm3d4pYWp0bOT/U9HuXD2cfbxWkJQbps0H/cRb8DlEnAP8xA/3tzPI 0Dy9anAImnv88WHWmsOdxTFeFqN7d+sKxKCwwPpLKbBn1tZ+cq2vr8hPmI+Dx2ZTQ6bF p7hnXzyQSf7uYS0hcf2z+UDuvblypj/hl/KXeyYZZOiQzFFMOboC5w/EMuaOQO9vu937 iVrNb/R1Ab+NM4NddSWCa3kdlaVQLDRphisit0/ywdQyiYv3EI7AHTsU2vDe30vth8ld goUFODpEl+Y5yk/q9DffW6V1JPAKpPKVxFbHVCapui7WtpQfbNbfl7EfCHHDfw8GLAJ4 9WJg== X-Gm-Message-State: APjAAAVhgEEH+V3UYBEkpyuB0QogffOolLlfDGsAcMdtNMFq7EFNRGPQ 1R3L+CKuDA89EMnwlBTH1lsw3OiYCjREmFPxVkjggQ== X-Received: by 2002:a05:600c:295:: with SMTP id 21mr3864373wmk.43.1573668760287; Wed, 13 Nov 2019 10:12:40 -0800 (PST) MIME-Version: 1.0 References: <20191113012746.52804-1-brendanhiggins@google.com> In-Reply-To: <20191113012746.52804-1-brendanhiggins@google.com> From: David Gow Date: Wed, 13 Nov 2019 10:12:28 -0800 Message-ID: Subject: Re: [PATCH linux-kselftest/test v1] Documentation: kunit: add documentation for kunit_tool To: Brendan Higgins Cc: Shuah Khan , kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , linux-doc@vger.kernel.org, corbet@lwn.net, tytso@mit.edu Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 12, 2019 at 5:28 PM Brendan Higgins wrote: > > Add documentation for the Python script used to build, run, and collect > results from the kernel known as kunit_tool. kunit_tool > (tools/testing/kunit/kunit.py) was already added in previous commits. > > Signed-off-by: Brendan Higgins > --- > Documentation/dev-tools/kunit/index.rst | 1 + > Documentation/dev-tools/kunit/kunit-tool.rst | 57 ++++++++++++++++++++ > Documentation/dev-tools/kunit/start.rst | 3 ++ > 3 files changed, 61 insertions(+) > create mode 100644 Documentation/dev-tools/kunit/kunit-tool.rst > > diff --git a/Documentation/dev-tools/kunit/index.rst b/Documentation/dev-tools/kunit/index.rst > index 26ffb46bdf99d..c60d760a0eed1 100644 > --- a/Documentation/dev-tools/kunit/index.rst > +++ b/Documentation/dev-tools/kunit/index.rst > @@ -9,6 +9,7 @@ KUnit - Unit Testing for the Linux Kernel > > start > usage > + kunit-tool > api/index > faq > > diff --git a/Documentation/dev-tools/kunit/kunit-tool.rst b/Documentation/dev-tools/kunit/kunit-tool.rst > new file mode 100644 > index 0000000000000..aa1a93649a45a > --- /dev/null > +++ b/Documentation/dev-tools/kunit/kunit-tool.rst > @@ -0,0 +1,57 @@ > +.. SPDX-License-Identifier: GPL-2.0 > + > +================= > +kunit_tool How-To > +================= > + > +What is kunit_tool? > +=================== > + > +kunit_tool is a set of scripts that aid in building the Linux kernel as UML > +(`User Mode Linux `_), running > +KUnit tests, parsing the test results and displaying them in a user friendly > +manner. Calling this a "set of scripts" is a bit confusing, as the only script described is tools/testing/kunit/kunit.py, which isn't mentioned in this section. Also, it may be worth linking to the new version of the UML website (even if the old one has more content). > + > +What is a kunitconfig? > +====================== > + > +It's just a defconfig that kunit_tool looks for in the base directory. > +kunit_tool uses it to generate a .config as you might expect. In addition, it > +verifies that the generated .config contains the CONFIG options in the > +kunitconfig; the reason it does this is so that it is easy to be sure that a > +CONFIG that enables a test actually ends up in the .config. > + > +How do I use kunit_tool? > +================================= > + > +If a kunitconfig is present at the root directory, all you have to do is: > + > +.. code-block:: bash > + > + ./tools/testing/kunit/kunit.py run > + > +However, you most likely want to use it with the following options: > + > +.. code-block:: bash > + > + ./tools/testing/kunit/kunit.py run --timeout=30 --jobs=8 > + > +- ``--timeout`` sets a maximum amount of time to allow tests to run. > +- ``--jobs`` sets the number of threads to use to build the kernel. > + Not directly an issue with the documentation, but this does raise the question of why we don't have better defaults. Alternatively, maybe this doc could suggest --jobs=`nproc` or similar? > +If you just want to use the defconfig that ships with the kernel, you can > +append the ``--defconfig`` flag as well: > + > +.. code-block:: bash > + > + ./tools/testing/kunit/kunit.py run --timeout=30 --jobs=8 --defconfig > + > +.. note:: > + This command is particularly helpful for getting started because it > + just works. No kunitconfig needs to be present. > + Should we use this in the getting started section below, then? Particularly since we're already going over kunitconfigs there separately. > +For a list of all the flags supported by kunit_tool, you can run: > + > +.. code-block:: bash > + Do you think it's worth documenting the remaining two (--build_dir and --raw_output) here too? > + ./tools/testing/kunit/kunit.py run --help > diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst > index aeeddfafeea20..1535c4394cfa2 100644 > --- a/Documentation/dev-tools/kunit/start.rst > +++ b/Documentation/dev-tools/kunit/start.rst > @@ -21,6 +21,9 @@ The wrapper can be run with: > > ./tools/testing/kunit/kunit.py run > > +For more information on this wrapper (also called kunit_tool) checkout the > +:doc:`kunit-tool` page. > + > Creating a kunitconfig > ====================== > The Python script is a thin wrapper around Kbuild as such, it needs to be > -- > 2.24.0.432.g9d3f5f5b63-goog >