Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10049572imu; Wed, 5 Dec 2018 15:11:57 -0800 (PST) X-Google-Smtp-Source: AFSGD/VskCMjs6BLaJ2txi+Y2BSMeYD04N740aAn5WKVasGioB9NW8PmbLSwwIdcaC4AUed2JcZK X-Received: by 2002:a63:3287:: with SMTP id y129mr21041720pgy.337.1544051517573; Wed, 05 Dec 2018 15:11:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544051517; cv=none; d=google.com; s=arc-20160816; b=EU9kPlEnNGJleq5JKChJD/KCrhyCnlP/yeDl5M0TkoBj+RpFe3G0pZYmGNiZdI0vlJ pFqNsQ8xsTM+Ww/D6NlFJ4G9+QDd6BQvJ+s8GpEP6ChlE1ffLd6Fo3zUJ08vG4BpL7j0 rbZWcApG/BYwx5q3lS9UkWyaqxmj1D2Oi6Q+Dans7yhOcSwM9hKwORlw7XqjeX5DM1gC 0SfsRk627lIUb2AjgQFTb4BJffikOmioDY5G9/E3BRmCi+u1e3lAYKdvU6xE27ednVdy g8IvepmRLnAZphO+SDxnj+niDpvY3ofe+652xUj6e5aMGDr5c5DGCmWVo2Q0nFWpBTOI JJ0A== 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=0FJYholUWmCppwSnPL76u/cNBHsuxKqsf1HdstAB4mw=; b=a+gYi6vpiQChWL79cMSJYsUoXCzeeW378FVz95xr6asZU0p//VBcfuDeU4Ctgmam9H ow8NOZ4vUTgXsyaoGlTlb71EQYRmZi6Z20Dm+I2ksZJ3waUefQx3QkQEjPNP1jyo29Oc M7rTY6g3o5y/zz8cRQ9LTYgfSTY1Mhm7Dx624vFIiCLaQZzH8ccdqIFOuER63zUKjFle rck7bGUVDr3E1b1SqNoC/st7W1g88Go/4v691RMXREbTLAlkgkWWb8zhV11myQA5H+i0 nLTH+Ib8tQW6qX3bvrz8/9D8Qn1FKkIndaQwaCtOqH+EQldgzek8wcganL5OOyORhtvC vMfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="rkcEX+/X"; 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 t10si20685627plh.307.2018.12.05.15.11.41; Wed, 05 Dec 2018 15:11:57 -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="rkcEX+/X"; 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 S1728755AbeLEXLD (ORCPT + 99 others); Wed, 5 Dec 2018 18:11:03 -0500 Received: from mail-oi1-f193.google.com ([209.85.167.193]:41218 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727630AbeLEXLD (ORCPT ); Wed, 5 Dec 2018 18:11:03 -0500 Received: by mail-oi1-f193.google.com with SMTP id j21so19090409oii.8 for ; Wed, 05 Dec 2018 15:11:02 -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=0FJYholUWmCppwSnPL76u/cNBHsuxKqsf1HdstAB4mw=; b=rkcEX+/XPPvW5QP6TXhLF4gEBNraOuQwq9x1w0toiaMzIWZP7hN+la+r/b6WHupxNX WWo0RjehuqBpzepy9+IeXLy9f4TUeT5OTlmf8xF5SQBv2w/3ScXp+lw9i1fZBPRDMYNf vCYcMIGBMzaKsscgawTUe2yKgV9nmlaVQVKtRqSatrzszbd6pP9D1kIvRBZ3QxflhIJd BobKeeWMPXvYcAjzySLN1FuP6T8pkuZChrZYdlNTJVMbErzzvcrvY0rW7WCUCCJRo1P2 xA/NO798A3xDeOy9wc8sP3O0cZLtv13MA0mTqQ4m2Mds0ZEQvwXIsH56aD37x+uMIySG gaxg== 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=0FJYholUWmCppwSnPL76u/cNBHsuxKqsf1HdstAB4mw=; b=SSULhwQ/rvWfTgWRIJjptc3YdaCkOIpA4HkCN0NRc4UOF3sZh/OwNZV1fxnePHQ9Ug URxD5ytenHmTzbg4nNUbnqY4A5eQFfKbdRWZQVdaen9DGCG6ZMSb3wUzM6pPAQOSxje0 213OIfE1YhkpOrjO3e5zhHbvqRSrjU4wAcWRHtgyEF2gi+pwHsbMrfWD9VGZZcurgImT 3qstlGfJMWXq4HQPUJUKMa4KJ2bh7qpOQJlBU+CtxEh8myTeICtD7bDmSCO/34gWGRlV utHX7OkfHg4RhfNJvjTpdTms3RRZK6ylgw8B62HC4KbhH4v49jTa6k/UsfPpibH5dwlQ Fh8w== X-Gm-Message-State: AA+aEWZj6Zcntm4VeNS1QWjdhEqxqahhcWW3T6jL9FTbFonYCK0Rd0q5 VkZYJnsOuD6L2WZ6X2C0o5oygTMNjQ29DZaWeUSZkw== X-Received: by 2002:aca:be41:: with SMTP id o62mr15379457oif.206.1544051461731; Wed, 05 Dec 2018 15:11:01 -0800 (PST) MIME-Version: 1.0 References: <20181128193636.254378-1-brendanhiggins@google.com> In-Reply-To: From: Brendan Higgins Date: Wed, 5 Dec 2018 15:10:50 -0800 Message-ID: Subject: Re: [RFC v3 00/19] kunit: introduce KUnit, the Linux kernel unit testing framework To: Rob Herring Cc: Frank Rowand , Greg KH , Kees Cook , mcgrof@kernel.org, shuah@kernel.org, Joel Stanley , mpe@ellerman.id.au, joe@perches.com, brakmo@fb.com, rostedt@goodmis.org, Tim.Bird@sony.com, khilman@baylibre.com, Julia Lawall , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, Linux Kernel Mailing List , jdike@addtoit.com, richard@nod.at, linux-um@lists.infradead.org, Daniel Vetter , dri-devel@lists.freedesktop.org, dan.j.williams@intel.com, linux-nvdimm@lists.01.org, kieran.bingham@ideasonboard.com, Knut Omang 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, Dec 4, 2018 at 5:49 AM Rob Herring wrote: > > On Tue, Dec 4, 2018 at 5:40 AM Frank Rowand wrote: > > > > Hi Brendan, Rob, > > > > Pulling a comment from way back in the v1 patch thread: > > > > On 10/17/18 3:22 PM, Brendan Higgins wrote: > > > On Wed, Oct 17, 2018 at 10:49 AM wrote: > > > > < snip > > > > > > The test and the code under test are linked together in the same > > > binary and are compiled under Kbuild. Right now I am linking > > > everything into a UML kernel, but I would ultimately like to make > > > tests compile into completely independent test binaries. So each test > > > file would get compiled into its own test binary and would link > > > against only the code needed to run the test, but we are a bit of a > > > ways off from that. > > > > I have never used UML, so you should expect naive questions from me, > > exhibiting my lack of understanding. > > > > Does this mean that I have to build a UML architecture kernel to run > > the KUnit tests? > > In this version of the patch series, yes. > > > *** Rob, if the answer is yes, then it seems like for my workflow, > > which is to build for real ARM hardware, my work is doubled (or > > worse), because for every patch/commit that I apply, I not only have > > to build the ARM kernel and boot on the real hardware to test, I also > > have to build the UML kernel and boot in UML. If that is correct > > then I see this as a major problem for me. > > I've already raised this issue elsewhere in the series. Restricting > the DT tests to UML is a non-starter. I have already stated my position elsewhere on the matter, but in summary: Ensuring most tests can run without external dependencies (hardware, VM, etc) has a lot of benefits and should be supported in nearly all cases, but such tests should also work when compiled to run on real hardware/VM; the tooling might not be as good in the latter case, but I understand that there are good reasons to support it nonetheless. So I am going to try to add basic support for running tests on other architectures in the next version or two. > > > Brenden, in the above quote you said that in the future you would > > like to make the "tests compile into completely independent test > > binaries". I am assuming those are intended to run as standalone > > user space programs instead of inside UML. Is that correct? If > > so, how will KUnit tests be able to test code that uses locking > > mechanisms that require instructions that are not available to > > user space execution? (I _think_ that such instructions may be > > present, depending on which locking mechanism, but I might be > > mistaken.) > > I think he means as kernel modules as kunit is for testing internal > kernel interfaces. kselftest is userspace level tests. Frank is right: my long term goal is to make it so unit tests can run as stand alone user space programs. > > If this were true about locking, then UML itself would not be viable. > > > Another possible concern that I have for removing the devicetree > > unit tests from my normal kernel build process is that I think > > that the ability to use sparse to analyze the source in the > > unit tests is removed. Please correct me if I misunderstand > > that. > > > > Another issue is that the devicetree unit tests will no longer > > be cross compiled with my ARM compiler, so I lose a small > > amount of testing for compiler related issues. > > 0-day does that for you. :) > > > Overall, I'm still trying to learn enough to determine whether > > the gains from moving to KUnit outweigh the losses. Of course. From what I have seen so far, the DT unittests seem like a pretty good use case for KUnit. If you don't mind, what frustrates you most about the tests you have now? What are the most common breakages you see? When do they get caught? My initial reaction when I looked at the tests was that it seemed like it would be hard to understand what caused a failure and it seemed non-obvious where a test for a new feature should go. To me, the thing that seemed like it needed the most work was refactoring the tests to make them easier to understand. For example, one thing I found when I started breaking the tests apart I found some cases that I really had to stare at (or run diff on them) to figure out what they did differently. Looking forward to get your thoughts.