Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9487621imu; Wed, 5 Dec 2018 05:42:14 -0800 (PST) X-Google-Smtp-Source: AFSGD/XrXjVF1WueTXYE3csrCouu9Wd8YXgjSUMyShl4IqezSgo+2r7gGgHWTCx1IVLcTxhHPG3y X-Received: by 2002:a17:902:7882:: with SMTP id q2mr24980751pll.305.1544017334398; Wed, 05 Dec 2018 05:42:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544017334; cv=none; d=google.com; s=arc-20160816; b=rZNMRClGwxswC4EUZwJMmn29Wef+//8AFS4zK/6RkOJRxenn1jpzOSpVbQMUCYdMOB IpRrYjUgab3zP6nGCcHcPEYH7COsvZMfpwbyrIYBBVNu1vXDRuiWp6LZe40Wnw+VNnU3 ZQBFOGanVRy1KJZArHQskMkN6AeMiLVKpdJXDGkmm31hJgg9OqS04o+MS/Ss1aDzRCzz AIrgV5W9s4hrEYPeWlCxrTIJ1W7FNi6BW46G2jY+z4tA6N+31hLvWkmSsCgUAKKCXmpx yuwrMvKMii0E1dFneS0+dQ5LawBY1FDJkj9IOPRxn9Ay1UShoW8Mv7DRPzrA8a67xY66 VFXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:organization:from:references:cc:to:subject; bh=w+hhY2ly7KWz9q1iOnucZ0EXDPkhVUOoJRW7BITt8zo=; b=V5LHw53NpL+hEwwXB73F1Rn/VkqB742iR+s7delWN3PB/pI0o6WitiZOQ6bT6jGh8E ayWHK5zQBrgm62XTNBYoE8HJw3zJNBgtGALsvt39Vrxca+VETWuY6W/a1z8EfVuGxnRK Gd0KcufTIPaftusdpgzZ8z/1IsMGVqZ54F7TdSnhE1SZhcclat/cZ77mgfeVquyhY3pl /HrGG3NmYzq9Y/m8HBKOONjNV1S+gFd3AVClfDEqODtYR0RXZdBMXhMKANKwu1reQpq4 mpmbrS7Uz35FE2p8Zg259DwyYUnm8nTXmorqFX6NEJYn24YiP0YiFMHyavRzvpHGQAfp EjoQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 44si20454586plb.57.2018.12.05.05.41.58; Wed, 05 Dec 2018 05:42:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727431AbeLENlU (ORCPT + 99 others); Wed, 5 Dec 2018 08:41:20 -0500 Received: from ivanoab6.miniserver.com ([5.153.251.140]:60878 "EHLO www.kot-begemot.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727240AbeLENlU (ORCPT ); Wed, 5 Dec 2018 08:41:20 -0500 X-Greylist: delayed 1498 seconds by postgrey-1.27 at vger.kernel.org; Wed, 05 Dec 2018 08:41:19 EST Received: from [192.168.17.6] (helo=smaug.kot-begemot.co.uk) by www.kot-begemot.co.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gUX1a-00066a-6V; Wed, 05 Dec 2018 13:15:34 +0000 Received: from wyvern.kot-begemot.co.uk ([192.168.3.72]) by smaug.kot-begemot.co.uk with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1gUX1U-0007WA-NC; Wed, 05 Dec 2018 13:15:33 +0000 Subject: Re: [RFC v3 01/19] kunit: test: add KUnit test runner core To: Luis Chamberlain , Brendan Higgins Cc: brakmo@fb.com, dri-devel@lists.freedesktop.org, Alexander.Levin@microsoft.com, linux-kselftest@vger.kernel.org, shuah@kernel.org, robh@kernel.org, frowand.list@gmail.com, linux-nvdimm@lists.01.org, richard@nod.at, knut.omang@oracle.com, kieran.bingham@ideasonboard.com, joel@jms.id.au, jdike@addtoit.com, Tim.Bird@sony.com, keescook@google.com, linux-um@lists.infradead.org, rostedt@goodmis.org, julia.lawall@lip6.fr, levinsasha928@gmail.com, dan.j.williams@intel.com, kunit-dev@googlegroups.com, gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, daniel@ffwll.ch, mpe@ellerman.id.au, joe@perches.com, khilman@baylibre.com References: <20181128193636.254378-1-brendanhiggins@google.com> <20181128193636.254378-2-brendanhiggins@google.com> <20181130031438.GQ4922@garbanzo.do-not-panic.com> From: Anton Ivanov Organization: Cambridge Greys Message-ID: Date: Wed, 5 Dec 2018 13:15:28 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20181130031438.GQ4922@garbanzo.do-not-panic.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US X-Spam-Score: -1.0 X-Spam-Score: -1.0 X-Clacks-Overhead: GNU Terry Pratchett Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/11/2018 03:14, Luis Chamberlain wrote: > On Wed, Nov 28, 2018 at 11:36:18AM -0800, Brendan Higgins wrote: >> +#define module_test(module) \ >> + static int module_kunit_init##module(void) \ >> + { \ >> + return kunit_run_tests(&module); \ >> + } \ >> + late_initcall(module_kunit_init##module) > Here in lies an assumption that suffices. I'm inclined to believe we > need new initcall level here so to ensure we *do* run after all the > respective kernels iniut calls. Otherwise we're left at the whims of > link order for kunit. For instance if a kunit test relies on frameworks > which are also late_initcall() we'd have complete incompatibility with > anything linked *after* kunit. > >> diff --git a/kunit/Kconfig b/kunit/Kconfig >> new file mode 100644 >> index 0000000000000..49b44c4f6630a >> --- /dev/null >> +++ b/kunit/Kconfig >> @@ -0,0 +1,17 @@ >> +# >> +# KUnit base configuration >> +# >> + >> +menu "KUnit support" >> + >> +config KUNIT >> + bool "Enable support for unit tests (KUnit)" >> + depends on UML > Consider using: > > if UML > ... > endif > > That allows the depends to be done once. > >> + help >> + Enables support for kernel unit tests (KUnit), a lightweight unit >> + testing and mocking framework for the Linux kernel. These tests are >> + able to be run locally on a developer's workstation without a VM or >> + special hardware. > > Some mention of UML may be good here? > >> For more information, please see >> + Documentation/kunit/ >> + >> +endmenu > I'm a bit conflicted here. This currently depends on UML but yet you > noted on RFC v2 that your intention is to liberate kunit from UML and > ideally allow unit tests to depend only on userspace. I've addressed > tests using both selftests kernels drivers and also re-written kernel > APIs to userspace to test there. I think we may need to live with both. > > Then for the UML stuff, I think if we *really* accept that UML will > always be a viable option we should probably consider now throwing these > things under drivers/platform/uml/. This follows the pattern of arch > specific drivers. Whether or not we end up with a complete userspace UML platform drivers predate that and are under arch/um/drivers/ We should either keep to current convention or consider relocating the existing ones - having things spread in different places around the tree is not good in the long run (UML already has a few of those under the x86 tree, let's not increase the number). > component independent of UML may implicate having a shared component > somewhere else. > > Likewise, I realize the goal is to *avoid* using a virtual machine for > these tests, but would it in any way make sense to share kunit to be > supported for other architectures to allow easier-to-write tests as > well? > > Luis > > _______________________________________________ > linux-um mailing list > linux-um@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-um > -- Anton R. Ivanov Cambridgegreys Limited. Registered in England. Company Number 10273661