Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3676429img; Mon, 25 Mar 2019 15:33:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqxywt1zkCZbnYdeXdt7W9Cs9NJHZeajPMBOVpQxpWJKUnmDcvrQYuH5FvAItv/Xh2ykl1Rf X-Received: by 2002:a63:29c8:: with SMTP id p191mr17706061pgp.197.1553553192282; Mon, 25 Mar 2019 15:33:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553553192; cv=none; d=google.com; s=arc-20160816; b=CPkeqNU1p7jZvBAxkWdG5f1I+NHFy+Q72V6nxY+lw9sIc+P6imP0dfiuEiTsmGQaoN wf5VlHWjnc9v1xMFxQqnEqDKvgRRowvxoHKQ6FOH9ZkPlN0kDEFL75aVVc5TQPdg0utZ /2ob/o0tuzFv7UZR89pzWuF4bxZGDjylp4b0Z33+46K4A4Dj2b1z6fQAWTAHJ1FC/PY+ GiUyUhDGUae05JbxrS5jzWKMeM4UnjT5zzsphiAjy1wbY/7en1568DUbnoQY31MeG1mh FNs2KoauVF8oU1npL7uv7DO8/0zgg/8XgSJWH+1oMtCqGSoBqdTyMpOpmxhXw10AmiQn Qidw== 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=WGWDtMK/dsTPDyC5sqpAIR0H6yQciJJiOWrefhHIEOU=; b=GsdbvZrApXQ8X2wyrkRH/l7+1dbRCU22VbcQsaR3vl2gepVucegSLYxxT/IjkezlOg pLIm34XmlL1g8zQgd1GptoBFXcQ8ahXCKwAsO6cuq4Ow4yOOLza13kH7c5hUGQ1NGp2a QOWZbIEwfYfInRE7YEEgACIrSMvCCxahReo01/S3MqfOuOY8dqOyJWAtbUBvBZRHcV4q GXytfTl7bZhhAae/+60Mn6TcODPpFbclkrnyBp/Lf9E6fKW/iSjvQS0G3vraN2hNh+lh z8SjTFzmn0jbrCpy5dgsQjpOETi52wV8BVKajqu06H4YSevmqw7l3yg9jgul3CW4w4hx ntng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=O3ExTykj; 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 j1si1111883pfe.189.2019.03.25.15.32.56; Mon, 25 Mar 2019 15:33:12 -0700 (PDT) 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=O3ExTykj; 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 S1730301AbfCYWcU (ORCPT + 99 others); Mon, 25 Mar 2019 18:32:20 -0400 Received: from mail-oi1-f193.google.com ([209.85.167.193]:39583 "EHLO mail-oi1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729714AbfCYWcU (ORCPT ); Mon, 25 Mar 2019 18:32:20 -0400 Received: by mail-oi1-f193.google.com with SMTP id n187so5552166oih.6 for ; Mon, 25 Mar 2019 15:32:19 -0700 (PDT) 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=WGWDtMK/dsTPDyC5sqpAIR0H6yQciJJiOWrefhHIEOU=; b=O3ExTykjQtCF9m/m8ZnZTZNyjSw/6FynnzGdt9KSg2tyAB1bp7g7i94Hjg7dzHmBnO 89dEjfQXr/3ayvSDgZ38Q25L+tq3w6lY7HkMpHoGiwXYvHHOFccgrgSIWUVQ/zEk3juU +hRaI2RsGqCWoPqWzIMQKHygzhBZfKmXNM4UCDXU2cDpob4LXVswYs++ZcSl/QrRru4M 1y7Dn4uZ5ptPLPgpvw+U6Gw2lhyWtUkMe9c/YXkiyJginA0hNGaz27Na4yKtPC7Yxy0l 9Nia7RU03h+L28U4xJkOSw4JIBLZh1/Z9VAmH3TpnTTCCLih6w4bnwbY5o1mYuvMyoek qrzw== 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=WGWDtMK/dsTPDyC5sqpAIR0H6yQciJJiOWrefhHIEOU=; b=aoe3vvr1TOeWvKxN6MW+hZuQlbquAGRZePXPA7HT0sLvnTdaKkwDDzhZRpwWJDwgBL gHa3IZtmPcby7Y33CGTMu+V5ZxjE8Ff68aCie158wg6SCvaZRufJmXhWq2smGhQZh0VE v2vAqM12LSxcTR7mPumf2OW7dfbo7ldRq2NJVCeArPi0OGJuh1hvrMoL/7DOH+rAiKLy foe7kTYX/eiu1GQxJx0/A1ai6UGGL9IWZZl+B7ZpqUPgaph3B5CCU8GupPrOK1CgWssm Knnip9dPpOOwqVpiqwILU6jNDVxgt4X4OUBSP3qSw+WRntwuZ86EIxBoD9HhniIwFAHW RWAw== X-Gm-Message-State: APjAAAUiAwzFKHJojHZuHKvW6/9+nRA/K1WUGK+KBxA1xo4E6cdhNMSQ UKLJPDkaeRSOMeteLDUcOA5LCvR9+Y3fD1h4UJkqsQ== X-Received: by 2002:aca:f594:: with SMTP id t142mr14148424oih.100.1553553138946; Mon, 25 Mar 2019 15:32:18 -0700 (PDT) MIME-Version: 1.0 References: <20190214213729.21702-1-brendanhiggins@google.com> <20190214213729.21702-9-brendanhiggins@google.com> <0124ed28-466c-e954-ddde-495419630a9f@gmail.com> <118d89b7-d468-6d68-a48d-4d6d9cefd106@gmail.com> In-Reply-To: From: Brendan Higgins Date: Mon, 25 Mar 2019 15:32:07 -0700 Message-ID: Subject: Re: [RFC v4 08/17] kunit: test: add support for test abort To: Knut Omang Cc: Frank Rowand , Kees Cook , Luis Chamberlain , shuah@kernel.org, Rob Herring , Kieran Bingham , Greg KH , Joel Stanley , Michael Ellerman , Joe Perches , brakmo@fb.com, Steven Rostedt , "Bird, Timothy" , Kevin Hilman , Julia Lawall , linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, Linux Kernel Mailing List , Jeff Dike , Richard Weinberger , linux-um@lists.infradead.org, Daniel Vetter , dri-devel , Dan Williams , linux-nvdimm , devicetree , Petr Mladek , Sasha Levin , Amir Goldstein , Dan Carpenter , wfg@linux.intel.com 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 Fri, Mar 22, 2019 at 12:11 AM Knut Omang wrote: > > On Thu, 2019-03-21 at 18:41 -0700, Brendan Higgins wrote: > > On Thu, Mar 21, 2019 at 6:10 PM Frank Rowand wrote: > > > On 2/27/19 11:42 PM, Brendan Higgins wrote: > > > > On Tue, Feb 19, 2019 at 10:44 PM Frank Rowand > > > > wrote: > > > > > On 2/19/19 7:39 PM, Brendan Higgins wrote: > > > > > > On Mon, Feb 18, 2019 at 11:52 AM Frank Rowand > > > > > > wrote: > > > > > > > On 2/14/19 1:37 PM, Brendan Higgins wrote: < snip > > > > > > > > kunit_abort() is what will be call as the result of an assert > > > > > > > failure. > > > > > > > > > > > > Yep. Does that need clarified somewhere. > > > > > > > BUG(), which is a panic, which is crashing the system is not > > > > > > > acceptable > > > > > > > in the Linux kernel. You will just annoy Linus if you submit this. > > > > > > > > > > > > Sorry, I thought this was an acceptable use case since, a) this should > > > > > > never be compiled in a production kernel, b) we are in a pretty bad, > > > > > > unpredictable state if we get here and keep going. I think you might > > > > > > have said elsewhere that you think "a" is not valid? In any case, I > > > > > > can replace this with a WARN, would that be acceptable? > > > > > > > > > > A WARN may or may not make sense, depending on the context. It may > > > > > be sufficient to simply report a test failure (as in the old version > > > > > of case (2) below. > > > > > > > > > > Answers to "a)" and "b)": > > > > > > > > > > a) it might be in a production kernel > > > > > > > > Sorry for a possibly stupid question, how might it be so? Why would > > > > someone intentionally build unit tests into a production kernel? > > > > > > People do things. Just expect it. > > > > Huh, alright. I will take your word for it then. > > I have a better explanation: Production kernels have bugs, unfortunately. > And sometimes those need to be investigated on systems than cannot be > brought down or affected more than absolutely necessary, maybe via a third party > doing the execution. A light weight, precise test (well tested ahead :) ) might > be a way of proving or disproving assumptions that can lead to the development > and application of a fix. Sorry, you are not suggesting testing in production are you? To be clear, I am not concerned about someone using testing, KUnit, or whatever in a *production-like* environment: that's not what we are talking about here. My assumption is that no one will deploy tests into actual production. > > IMHO you're confusing "building into" with temporary applying, then removing > again - like the difference between running a local user space program vs > installing it under /usr and have it in everyone's PATH. I don't really see the point of distinguishing between "building into" and "temporary applying" in this case; that's part of my point. Maybe it makes sense in whitebox end-to-end testing, but in the case of unit testing, I don't think so. > > > > > > a') it is not acceptable in my development kernel either > > I think one of the fundamental properties of a good test framework is that it > should not require changes to the code under test by itself. > Sure, but that has nothing to do with the environment the code/tests are running in. < snip > Cheers