Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2294183ybl; Thu, 30 Jan 2020 14:58:54 -0800 (PST) X-Google-Smtp-Source: APXvYqwqUiBjrksfZ0NPTz5X5536Pm8fnWW3d4jw0BS2Gwt8TgEyUXMx7XiihbAVHk2MTSxMSfv0 X-Received: by 2002:a9d:4801:: with SMTP id c1mr5580518otf.258.1580425133970; Thu, 30 Jan 2020 14:58:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580425133; cv=none; d=google.com; s=arc-20160816; b=Qoch2VHfiGObPOW3n27kiZC/ZK1AjE5lv4MNpdOlcUsotLI/SYeB36xkE7dgrJ6hqt OFhrcOtCf69zdpNMfpABD3fAWSVnVL8LDkj1/MT+5wNUbJTuaK1TKLVxoPuAS6BHvIz7 TZT/ueyv7c5aFepSCCMyV1WZfP8O3xXHsHeL9DfI5nOIUtQ8SsxarWMkIDyjoYEJ7QZZ YTOx4gVHyNjW5syCs92+evpfL42Ly28KWaD2i8SJxzPuLXt30TPiKzcbPnxaZrezOAT5 BPREScf5kFj25BMkYa3YA3xy3yVQXKqsTzGxy5Vf1H33iCAtOyVcgKUAiCxCrtgon90c XHZQ== 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=F0OASKqvkAbKhPJi+8BLbJXf7NsJuVGG2F01NRx4uXs=; b=HFdVjNo9Qo+57+0gH+oLJsPsu2h+X4R4i8rd1sjNrXXIX7E+Z9FSBK+bjVqG8a1KGi hjVNexhY/ZrqH0K9GTnsSCkGzXs9xYdyR+ekRqwa2bruxhK+SknGvySZo9B2M2psTHUV v6ZR7DU9/+3i4OTlhs8TAsqJhRnSB+4V2vK2xHBR76KpbIQWnOSk5lhZKt32OofLIP6L az1IGJd2tZTmcT4vLr5NLyHP+GwRIK3OoQ78RLCvaB9hfFrN8PdX4jZhcG99espbKj6d yjC92rQ5GanTw8gv/9gjyY2yAUyNS8aDbcYwtyBDN6KDOoG+DoAKEmRbOS+wBgA8ZTvw OeMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=uVpoLgWj; 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 71si3890312otm.111.2020.01.30.14.58.40; Thu, 30 Jan 2020 14:58:53 -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=uVpoLgWj; 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 S1727520AbgA3W5A (ORCPT + 99 others); Thu, 30 Jan 2020 17:57:00 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:42862 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726294AbgA3W47 (ORCPT ); Thu, 30 Jan 2020 17:56:59 -0500 Received: by mail-pl1-f196.google.com with SMTP id p9so1911255plk.9 for ; Thu, 30 Jan 2020 14:56:59 -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=F0OASKqvkAbKhPJi+8BLbJXf7NsJuVGG2F01NRx4uXs=; b=uVpoLgWjGXuzd5yfcWM9lhJIpdK7H/ed03v0i4oe6ecKcTEcyUagDQonSnpspNqBrg vzRW3ikS7UJQyY4Dj4PvpzbOlFmWNIQh30F18QIPfzj4FV1GaUcHqdOzZ3waSZX28dFR owP1VctM6Zpi+bhXbngtnNxU5Npm2UP3BFLONGvIskBJ+Hso+Gm7uzXKWMzhnG1Wu8Zr 3raQdUvOYsYH0Sw1qO1QgwRs+xaKfx7EYur5a3+Wfbi0ZwyEdL1Yu5dOLhbV7Pnmq3Wo HmdITpnr8Myjlm7LxKgu2hN0B/4IlgJdB1tejGrAsObwA/gpPvKq22x5TFLXzj7T6OSa Nmqg== 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=F0OASKqvkAbKhPJi+8BLbJXf7NsJuVGG2F01NRx4uXs=; b=ABKtTrPUd5I53KQUD2RkNn9XrKrwYK4CMCgzShCJne7KjHnif7Eh9x1dwmGIae9kL0 pGY3x7Zo+B63r8zN1Vy2pr39jFyiEmWEP3J4Ijo+UFnuaxTie/w2tEC34JYdjBnlsviH iXcFu82q+uAfHHu79Ip97Ozex1Mz/KHW9GodVHvU8JJH1Mbc9pBoL0tg3XyKfGnAe/8D nG4wsdEZimTceU2y2RVQuKd/X1FuypKZEzNOcmFkJ4eMc1F46MRuHKgUDFeF4dfG5HuI lr1HfW7QhRYjhz01m4ZFmnneZyIqu3iMxIbw2iZpUqrHppCH/BAQJqqof6CsI7LQO05C MmUQ== X-Gm-Message-State: APjAAAXiGmEi3Go2ZZowPoFi35JEfZyKIifA85eD4nFfMVFTz6yQwuH5 OoPqUKpI16qx2l22/QyMnJqZbK6Fa4l1sCprvW/Mlg== X-Received: by 2002:a17:902:9a4c:: with SMTP id x12mr6694919plv.297.1580425018923; Thu, 30 Jan 2020 14:56:58 -0800 (PST) MIME-Version: 1.0 References: <20200128072002.79250-1-brendanhiggins@google.com> <20200128072002.79250-7-brendanhiggins@google.com> <20200129063307.19CB4206F0@mail.kernel.org> In-Reply-To: <20200129063307.19CB4206F0@mail.kernel.org> From: Brendan Higgins Date: Thu, 30 Jan 2020 14:56:47 -0800 Message-ID: Subject: Re: [PATCH v1 6/7] kunit: Add 'kunit_shutdown' option To: Stephen Boyd Cc: Andrew Morton , Alan Maguire , Anton Ivanov , Arnd Bergmann , David Gow , Frank Rowand , Jeff Dike , Kees Cook , Richard Weinberger , rppt@linux.ibm.com, Shuah Khan , Iurii Zaikin , Greg KH , 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, Jan 28, 2020 at 10:33 PM Stephen Boyd wrote: > > Quoting Brendan Higgins (2020-01-27 23:20:01) > > From: David Gow > > > > Add a new kernel command-line option, 'kunit_shutdown', which allows the > > user to specify that the kernel poweroff, halt, or reboot after > > completing all KUnit tests; this is very handy for running KUnit tests > > on UML or a VM so that the UML/VM process exits cleanly immediately > > after running all tests without needing a special initramfs. > > > > Signed-off-by: David Gow > > Signed-off-by: Brendan Higgins > > --- > > Two nitpicks below > > Reviewed-by: Stephen Boyd > > > diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c > > index 7fd16feff157e..d3ec1265a72fd 100644 > > --- a/lib/kunit/executor.c > > +++ b/lib/kunit/executor.c > > @@ -1,6 +1,7 @@ > > // SPDX-License-Identifier: GPL-2.0 > > > > #include > > +#include > > Should this include come before kunit/test.h? I imagine the order of > includes would be linux, kunit, local? I think some reviewers/maintainers want them all to be alphabetical. So I have probably done it both ways in the past. Will fix. > > > > /* > > * These symbols point to the .kunit_test_suites section and are defined in > > @@ -11,6 +12,23 @@ extern struct kunit_suite * const * const __kunit_suites_end[]; > > > > #if IS_BUILTIN(CONFIG_KUNIT) > > > > +static char *kunit_shutdown; > > +core_param(kunit_shutdown, kunit_shutdown, charp, 0644); > > + > > +static void kunit_handle_shutdown(void) > > +{ > > + if (!kunit_shutdown) > > + return; > > + > > + if (!strcmp(kunit_shutdown, "poweroff")) { > > + kernel_power_off(); > > + } else if (!strcmp(kunit_shutdown, "halt")) { > > + kernel_halt(); > > + } else if (!strcmp(kunit_shutdown, "reboot")) { > > + kernel_restart(NULL); > > + } > > Kernel style would be to not have braces on single line if statements. Whoops. Sometimes I forget :-) > > +} > > + > > static void kunit_print_tap_header(void) > > { > > struct kunit_suite * const * const *suites, * const *subsuite; Thanks!