Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1243909ybl; Tue, 3 Dec 2019 04:10:59 -0800 (PST) X-Google-Smtp-Source: APXvYqyUZhp7S+dbI6GscN5LjWqmU3RV/x50b6YJpFnp8osXxypozDfJOGzHiurktc+8uSJzaaEW X-Received: by 2002:aca:568d:: with SMTP id k135mr3300298oib.45.1575375058847; Tue, 03 Dec 2019 04:10:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575375058; cv=none; d=google.com; s=arc-20160816; b=XvEa25uHVkUEgaY+Z4kAGgKvBoUcz6MWFZXN+KpasViQuBAta1t4zCODSS2UzpF2I+ FO+lnqy+ZX+fMs/Dmkoii1XDZMq+bkGNvsxVMeXbHAS14dXnE6CvHPJJ1Vl2ljecKKoR ax51l9Hoc6kSbV+nkgHWhEccNhhejP/9HFUV9AjZsuZgYhikCR6Zz0Ha/BWBTP647KSj ot7dM8WBJKP7M4TY07l8OcWLPS2Adk/2v+Fm6T5DUKwDk1OE2TNUIUkuqnWQp/5KckoZ ldZS7P3dcj5SiriveAA8uMAsTPjDk7zERQZFJct6PfLainTpPloVmd48Vp3+SLmLA79p 90Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=CNr0y+ZoPApz+Tp45+kJAccK/U23wlJ3cxKmAvkb2ZI=; b=EVdqiF5OhDFZhWWcPJOS3Rgm3PjsD2d0TJ3EVVXHReDOMmanvc5jpuJwflvv062La7 sgfrA1JKhejPOOktlYtiJkyQAf4eo2iHcVUP29eXntNz/tMOgu6NKqQALKG3A/1bn2rR Ue8GzfbkomYBZfKS9eG+3Xo97ahRnZ8yAdUFzRTANN9ZkxPj9mHYTLp8Xcq94SkVTLi2 4Ad9mpkgVu2qdewUzFubcVhBfVQOZTh0uXeiojO6gtPf2Gpbt3H6G6nRpAcL7IkhG41c 6Y/oErPdb73E/qEyMYC7TVEFi833SEAZSft8+c7UYvXwM4hCTO5eWFP7paiu7Idg3Qc0 w8Xg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2019-08-05 header.b=XshhpMXm; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m9si1160200oic.14.2019.12.03.04.10.46; Tue, 03 Dec 2019 04:10:58 -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=@oracle.com header.s=corp-2019-08-05 header.b=XshhpMXm; 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=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726592AbfLCMJM (ORCPT + 99 others); Tue, 3 Dec 2019 07:09:12 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:46302 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726318AbfLCMJL (ORCPT ); Tue, 3 Dec 2019 07:09:11 -0500 Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xB3Bs2uf147819; Tue, 3 Dec 2019 12:08:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=corp-2019-08-05; bh=CNr0y+ZoPApz+Tp45+kJAccK/U23wlJ3cxKmAvkb2ZI=; b=XshhpMXm4z9mCI2Ceys9JEAiTAY87sFJ/a8ze8ca63aECp348cHrJAt1IzPUtrXqCRpA hHhtmT5dZIHCgfKK/u2LAcBJP6xtXHyp3PmonrbUqrZY1r2y9oE04oYYew6u46P5+GA4 kLy1K/PxYhGxAXl01KOQh887yCsumleADosj1T2VAKowVJfIwi8XYw1Lqi3BW+l4NLWK ckGBhygeLdEb9zsWrsvXDYEmNHqU47/UBhG5UsotU0rE8XKoV3UVYSOqJXWs6AfPWrUd yyuD6C84X1cLsane1EUP4eu9oWLoz7z4hR9E7mt7GgtXAWNo4yB3Qw6O7GzSyp7VutfF 1w== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by aserp2120.oracle.com with ESMTP id 2wkgcq75ws-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Dec 2019 12:08:52 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.27/8.16.0.27) with SMTP id xB3BsX9a161922; Tue, 3 Dec 2019 12:08:52 GMT Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userp3020.oracle.com with ESMTP id 2wn4qpupdp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 03 Dec 2019 12:08:51 +0000 Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id xB3C8oM6027265; Tue, 3 Dec 2019 12:08:50 GMT Received: from dhcp-10-175-211-120.vpn.oracle.com (/10.175.211.120) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 03 Dec 2019 04:08:49 -0800 From: Alan Maguire To: brendanhiggins@google.com, linux-kselftest@vger.kernel.org Cc: linux-kernel@vger.kernel.org, kunit-dev@googlegroups.com, keescook@chromium.org, yzaikin@google.com, akpm@linux-foundation.org, yamada.masahiro@socionext.com, catalin.marinas@arm.com, joe.lawrence@redhat.com, penguin-kernel@i-love.sakura.ne.jp, urezki@gmail.com, andriy.shevchenko@linux.intel.com, corbet@lwn.net, davidgow@google.com, adilger.kernel@dilger.ca, tytso@mit.edu, mcgrof@kernel.org, linux-doc@vger.kernel.org, Alan Maguire , Knut Omang Subject: [PATCH v5 linux-kselftest-test 6/6] kunit: update documentation to describe module-based build Date: Tue, 3 Dec 2019 12:07:48 +0000 Message-Id: <1575374868-32601-7-git-send-email-alan.maguire@oracle.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1575374868-32601-1-git-send-email-alan.maguire@oracle.com> References: <1575374868-32601-1-git-send-email-alan.maguire@oracle.com> X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9459 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=4 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1912030096 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9459 signatures=668685 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=4 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1911140001 definitions=main-1912030096 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Documentation should describe how to build kunit and tests as modules. Co-developed-by: Knut Omang Signed-off-by: Knut Omang Signed-off-by: Alan Maguire Reviewed-by: Stephen Boyd --- Documentation/dev-tools/kunit/faq.rst | 3 ++- Documentation/dev-tools/kunit/index.rst | 3 +++ Documentation/dev-tools/kunit/usage.rst | 16 ++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Documentation/dev-tools/kunit/faq.rst b/Documentation/dev-tools/kunit/faq.rst index bf20951..ea55b24 100644 --- a/Documentation/dev-tools/kunit/faq.rst +++ b/Documentation/dev-tools/kunit/faq.rst @@ -29,7 +29,8 @@ Yes, well, mostly. For the most part, the KUnit core framework (what you use to write the tests) can compile to any architecture; it compiles like just another part of the -kernel and runs when the kernel boots. However, there is some infrastructure, +kernel and runs when the kernel boots, or when built as a module, when the +module is loaded. However, there is some infrastructure, like the KUnit Wrapper (``tools/testing/kunit/kunit.py``) that does not support other architectures. diff --git a/Documentation/dev-tools/kunit/index.rst b/Documentation/dev-tools/kunit/index.rst index 26ffb46..7ddc385 100644 --- a/Documentation/dev-tools/kunit/index.rst +++ b/Documentation/dev-tools/kunit/index.rst @@ -48,6 +48,9 @@ to a standalone program that can be run like any other program directly inside of a host operating system; to be clear, it does not require any virtualization support; it is just a regular program. +Alternatively, kunit and kunit tests can be built as modules and tests will +run when the test module is loaded. + KUnit is fast. Excluding build time, from invocation to completion KUnit can run several dozen tests in only 10 to 20 seconds; this might not sound like a big deal to some people, but having such fast and easy to run tests fundamentally diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-tools/kunit/usage.rst index c6e6963..82f9213 100644 --- a/Documentation/dev-tools/kunit/usage.rst +++ b/Documentation/dev-tools/kunit/usage.rst @@ -539,6 +539,22 @@ Interspersed in the kernel logs you might see the following: Congratulations, you just ran a KUnit test on the x86 architecture! +In a similar manner, kunit and kunit tests can also be built as modules, +so if you wanted to run tests in this way you might add the following config +options to your ``.config``: + +.. code-block:: none + + CONFIG_KUNIT=m + CONFIG_KUNIT_EXAMPLE_TEST=m + +Once the kernel is built and installed, a simple + +.. code-block:: bash + modprobe example-test + +...will run the tests. + Writing new tests for other architectures ----------------------------------------- -- 1.8.3.1