Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1875687ybv; Thu, 6 Feb 2020 11:24:19 -0800 (PST) X-Google-Smtp-Source: APXvYqysADOiLRj34iRP+oK4/a5amUs39JKSJ6Zeqi3/1gUEWMUy206gaG34+gwUhyCLzTC4SfPI X-Received: by 2002:aca:534f:: with SMTP id h76mr8128086oib.23.1581017058836; Thu, 06 Feb 2020 11:24:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581017058; cv=none; d=google.com; s=arc-20160816; b=tlenbZhmRfxIJDF40+wH7QmERy1zuqLTJor9EN3/99TLFQVT7mrQvjknXbPSmteO/N 0JB7YCS+p+aFYm0Q6zNyVKqvwPvmBQVCDsUAcMHPAXXATHQSEBLdXqB+bTZBdIpijMxZ msYsyflQ741Rht+hbfSQIgXVMmbcME0L1ZKvtA9nCetR7BBvfYpPGX/hvn1azKU1mcDG /68taIE/HQQyB7jP1/Xep0VGcS/nFx206frmjop96qJLc4rA6HLDQSxA6jRdGjCYtcTX 2zr5hUDeKOvEK6HVELDLiGx2fv/Q3OXlxQCfpy+ZKXKV0J6v5wZsINpsiaN3w5EecRsF LOdg== 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=OFxWhBE8bCLkAqt3LltRZI+Cx2EWphixiKp7DcpUO/0=; b=kt7jr1LxzG5rpw5k5eYCuDmGCB8AV3v3XVHxBBCxT1h6Ne0PE3InIWUcGp9l93QPus dDbV00l2DsjL28HAUsit0m3UOVi5aQ/gOukLiBCLRMxMglP+m/rEjKT1iQ0l8qSWZQ7h q0FzEm0iZZjA2q+M06nYKMuh1pkKodOkqN5LkfxXoYXjjn0R+SqaxEJUSksmVaysRwSn tCieXqmJiVr0quAzoixj8IVZAEom94zRInjeGLKkabFcIw8RgL59t4CP2ivJb4Hisc2D +dRYfhw/Az+Nuy5xxI9TXxoSjYxOcGGwuh/jsh4G0G6Wi/qKTM8aihDtxsBRFrHEr+8o GtBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=EPfii1aY; 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 a6si2424267oia.33.2020.02.06.11.24.06; Thu, 06 Feb 2020 11:24:18 -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=EPfii1aY; 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 S1727999AbgBFTXH (ORCPT + 99 others); Thu, 6 Feb 2020 14:23:07 -0500 Received: from mail-wm1-f45.google.com ([209.85.128.45]:55856 "EHLO mail-wm1-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727945AbgBFTXH (ORCPT ); Thu, 6 Feb 2020 14:23:07 -0500 Received: by mail-wm1-f45.google.com with SMTP id q9so1208456wmj.5 for ; Thu, 06 Feb 2020 11:23:04 -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=OFxWhBE8bCLkAqt3LltRZI+Cx2EWphixiKp7DcpUO/0=; b=EPfii1aYTJIzjpQ7Ag+p8JdkObOGGXjn000PKaanUZFEK/9ZTopIuUpSYjMABv6D2t DYoVeBOVMd6JNFsPnKwXEGAm41Ux1DNvqRD5yWArwSwaiHcT150ahPWydxSH46gFP4wG W/gW1e0FBvf73ONT40/pARQLAAmS0vil8HaJTQ41ZyuW+5ezSWvNz1xwRRtrwrGYM/nQ bhy684fiJSYAXVJFOHd6+vp3zRNeJSXavFxPfhRVJdGKPVaUDEZE3GijvNFikGu6MG3f wkbqINqNfPCOqB/aQSajogPme/1aZ6WNuUaH13Vjeva8tdunxbscU3y84RYKlOO+GT5D 7GOQ== 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=OFxWhBE8bCLkAqt3LltRZI+Cx2EWphixiKp7DcpUO/0=; b=kC/CA60A73QXl8Lu0klp23LHKfKMfNn3fM+rA2SRsIiNiGGoVpz4X5Aj+wy9odvGGM ZypoT5hPbgg3D5ebOEkDxQZMzVnJhlabkF57mJmtONMjdp1dQIwQkgI+O6OQzWfk+z7f /5dUXnUUVoDK/vlHEFMPwTSh5rQAHvMuQJ/nVMNq7wsiE6WtVTfGeqK9DZY/GgaxCfQh FHCegQ37xtpbZTEzkqYJEVSdGi2sxgS8l+YtTn0PHCVuXE01RX3LeEBK3CCNUV8pymwx UJ+bfRMcgJbqcst/giBbwOWoJlmo9Q5+JCTlYljbWX9u7UjsR8tDvP1N1XSTipHpdOFs Cc1w== X-Gm-Message-State: APjAAAUFIVbJlEyqHWLz7Xbdx80pRYEC2Yu2FVoxgQcRgGmvxgYMrqB9 K4S0EO33+6F97FjKEkOnpPQAMQf2/lqehe2ods0kSg== X-Received: by 2002:a05:600c:2942:: with SMTP id n2mr5993040wmd.87.1581016983392; Thu, 06 Feb 2020 11:23:03 -0800 (PST) MIME-Version: 1.0 References: <20200130230812.142642-1-brendanhiggins@google.com> <20200130230812.142642-3-brendanhiggins@google.com> <1da1538d-2e4c-0ed0-5fae-6f9033230c46@gmail.com> In-Reply-To: From: David Gow Date: Thu, 6 Feb 2020 11:22:51 -0800 Message-ID: Subject: Re: [PATCH v2 2/7] arch: um: add linker section for KUnit test suites To: Brendan Higgins Cc: Frank Rowand , Jeff Dike , Richard Weinberger , Anton Ivanov , Arnd Bergmann , Kees Cook , Shuah Khan , Alan Maguire , Iurii Zaikin , Andrew Morton , rppt@linux.ibm.com, Greg KH , Stephen Boyd , Logan Gunthorpe , Luis Chamberlain , Knut Omang , linux-um , linux-arch@vger.kernel.org, "open list:KERNEL SELFTEST FRAMEWORK" , KUnit Development , Linux Kernel Mailing List , "open list:DOCUMENTATION" 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, Feb 4, 2020 at 5:17 PM 'Brendan Higgins' via KUnit Development wrote: > > On Tue, Feb 4, 2020 at 3:17 PM Frank Rowand wrote: > > > > On 2/4/20 4:30 PM, Brendan Higgins wrote: > > > On Tue, Feb 4, 2020 at 1:59 PM Frank Rowand wrote: > > >> > > >> Can you please add a section to the KUnit documentation that lists things > > >> like the expectations, requirements, limitations, etc for a test case that > > >> is run by KUnit? Some examples that pop to mind from recent discussions > > >> and my own experiences: > > >> > > >> - Each test case is invoked after late_init is complete. > > >> + Exception: the possible value of being able to run a unit test > > >> at a specific runlevel has been expressed. If an actual unit > > >> test can be shown to require running earlier, this restriction > > >> will be re-visited. > > >> > > >> - Each test case must be idempotent. Each test case may be called > > >> multiple times, and must generate the same result each time it > > >> is called. > > >> + Exception 1: a test case can be declared to not be idempotent > > >> [[ mechanism TBD ]], in which case KUnit will not call the > > >> test case a second time without the kernel rebooting. > > >> + Exception 2: hardware may not be deterministic, so a test that > > >> always passes or fails when run under UML may not always to > > >> so on real hardware. <--- sentence copied from > > >> Documentation/dev-tools/kunit/usage.rst > > >> [[ This item and 1st exception do not exist yet, but will exist > > >> in some form if the proposed proc filesystem interface is > > >> added. ]] > > >> > > >> - KUnit provides a helpful wrapper to simplify building a UML kernel > > >> containing the KUnit test cases, booting the UML kernel, and > > >> formatting the output from the test cases. This wrapper MUST NOT > > >> be required to run the test cases or to determine a test result. > > >> The formatting may provide additional analysis and improve > > >> readability of a test result. > > >> > > >> - .... There is more that belongs here, but I'm getting side tracked > > >> here, when I'm trying to instead convert devicetree unittests to > > >> KUnit and want to get back to that. > > > > > > Sure, I think that's a great start! Thanks for that. I hope you don't > > > mind if I copy and paste some of it. > > > > Please do. And no need to credit me. > > > > > > > It kind of sounds like you are talking about more of a requirements > > > doc than the design doc I was imagining in my reply to you on the > > > cover letter, which is fine. The documentation is primarily for people > > > other than me, so whatever you and others think is useful, I will do. > > > > > > > I wasn't really sure what to label it as. My inspiration was based > > a little bit on reading through the Linux 5.5 KUnit source and > > documentation, and trying to understand the expectations of the > > KUnit framework and what the test cases have to either obey or > > can expect. > > > > I think there is a lot of history that you know, but is only visible > > to test implementors if they read through the past couple of years > > email threads. > > Yeah, that's no good. We need to provide a better experience than > that. David has gotten deeply involved relatively recently: I suspect > that he might have some good insight on this. > > David, you mentioned offline that there are some philosophical changes > in how we think about KUnit that has happened that you feel have never > quite been captured in the docs. Do you think this is part of what > Frank has pointed out here? If not, do you have any thoughts about > what we should call this documentation section? > > Shuah's first KUnit PR seemed to imply that KUnit was primarily for > UML, or only fully supported under UML. So I think I might be the odd > one out thinking that that has changed and the documentation properly > conveys that. Yeah: I think the documentation could do with some improvements on these fronts: there are a few places which imply that KUnit requires UML, which is definitely not the case. We still want to encourage people to try UML: it's usually the quickest way of running tests, but KUnit itself should remain architecture-independent, as should as many tests as possible. I think there are probably (at least) two different things that need doing to make these sorts of miscommunications less likely. The bulk of the documentation needs to stop referring to KUnit as something built upon or using UML (while still making it clear that some of our tooling defaults to or requires UML at the moment). This shows up in a lot of the "What is KUnit/Why use KUnit" sections in both the kernel docs and the KUnit website. Secondly, we need to document the test environment (possibly alongside some test style best practises, possibly separately). Given that work like the debugfs stuff and how to support tests which need __init data or need to only run once is still ongoing, I'm not sure if we can definitively state what the solutions there will be yet, but noting that tests should not depend on a specific architecture like UML (unless they're testing architecture-specific code in a way that can't reasonably be made architecture independent) is worth doing sooner rather than later. I'll see if I can put a few doc patches together to update/fix at least some of the most egregious examples. Cheers, -- David