From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Boyd Subject: Re: [PATCH v1 6/7] kunit: Add 'kunit_shutdown' option Date: Tue, 28 Jan 2020 22:33:06 -0800 Message-ID: <20200129063307.19CB4206F0@mail.kernel.org> References: <20200128072002.79250-1-brendanhiggins@google.com> <20200128072002.79250-7-brendanhiggins@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <20200128072002.79250-7-brendanhiggins@google.com> Sender: linux-doc-owner@vger.kernel.org To: akpm@linux-foundation.org, alan.maguire@oracle.com, anton.ivanov@cambridgegreys.com, arnd@arndb.de, davidgow@google.com, frowand.list@gmail.com, jdike@addtoit.com, keescook@chromium.org, richard@nod.at, rppt@linux.ibm.com, skhan@linuxfoundation.org, yzaikin@google.com Cc: gregkh@linuxfoundation.org, logang@deltatee.com, mcgrof@kernel.org, knut.omang@oracle.com, linux-um@lists.infradead.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Brendan Higgins List-Id: linux-arch.vger.kernel.org Quoting Brendan Higgins (2020-01-27 23:20:01) > From: David Gow >=20 > 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. >=20 > 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 > =20 > #include > +#include Should this include come before kunit/test.h? I imagine the order of includes would be linux, kunit, local? > =20 > /* > * These symbols point to the .kunit_test_suites section and are defined= in > @@ -11,6 +12,23 @@ extern struct kunit_suite * const * const __kunit_suit= es_end[]; > =20 > #if IS_BUILTIN(CONFIG_KUNIT) > =20 > +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. > +} > + > static void kunit_print_tap_header(void) > { > struct kunit_suite * const * const *suites, * const *subsuite; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200128072002.79250-7-brendanhiggins@google.com> References: <20200128072002.79250-1-brendanhiggins@google.com> <20200128072002.79250-7-brendanhiggins@google.com> From: Stephen Boyd Subject: Re: [PATCH v1 6/7] kunit: Add 'kunit_shutdown' option Date: Tue, 28 Jan 2020 22:33:06 -0800 Message-ID: <20200129063307.19CB4206F0@mail.kernel.org> Sender: linux-doc-owner@vger.kernel.org To: Brendan Higgins , akpm@linux-foundation.org, alan.maguire@oracle.com, anton.ivanov@cambridgegreys.com, arnd@arndb.de, davidgow@google.com, frowand.list@gmail.com, jdike@addtoit.com, keescook@chromium.org, richard@nod.at, rppt@linux.ibm.com, skhan@linuxfoundation.org, yzaikin@google.com Cc: gregkh@linuxfoundation.org, logang@deltatee.com, mcgrof@kernel.org, knut.omang@oracle.com, linux-um@lists.infradead.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org List-ID: Message-ID: <20200129063306.sxdrL47y_GB1-JoekTwFIMvBQiFrGz2KZ_qNm4Sr4L0@z> Quoting Brendan Higgins (2020-01-27 23:20:01) > From: David Gow >=20 > 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. >=20 > 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 > =20 > #include > +#include Should this include come before kunit/test.h? I imagine the order of includes would be linux, kunit, local? > =20 > /* > * These symbols point to the .kunit_test_suites section and are defined= in > @@ -11,6 +12,23 @@ extern struct kunit_suite * const * const __kunit_suit= es_end[]; > =20 > #if IS_BUILTIN(CONFIG_KUNIT) > =20 > +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. > +} > + > static void kunit_print_tap_header(void) > { > struct kunit_suite * const * const *suites, * const *subsuite; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 14B71C33CB2 for ; Wed, 29 Jan 2020 06:33:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9ED23206A2 for ; Wed, 29 Jan 2020 06:33:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580279588; bh=28tEdmx9LwLU3uCpRLofPRp2G5hnsl0hstln6/EfErI=; h=In-Reply-To:References:From:Subject:To:Cc:Date:List-ID:From; b=QrcYzYL4jg9ESQBP1zRXpE3q2P+Hg/CGNsTiMmMlkRcqJj50G2/TjTv6r+lePq24M yPleNWW/BWTxze+1rIINDXj8065kxPOFAIEX4gfTchyujqhDQcx2p4Pvm5d6WRganj eBO1RrjXFBeJi8H36o8/crUaegpKZaviF/OJ0ig8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726037AbgA2GdI (ORCPT ); Wed, 29 Jan 2020 01:33:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:46302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726020AbgA2GdI (ORCPT ); Wed, 29 Jan 2020 01:33:08 -0500 Received: from kernel.org (unknown [104.132.0.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 19CB4206F0; Wed, 29 Jan 2020 06:33:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580279587; bh=28tEdmx9LwLU3uCpRLofPRp2G5hnsl0hstln6/EfErI=; h=In-Reply-To:References:From:Subject:To:Cc:Date:From; b=hpswgamHW1zjyT7O2a0FPMr/N6O6c98hZVj9cwxMj0wb0TseNdIUbahMdqnjEt2MI xVOcrIYzJkoZJx5HLe2VlxdXmzVlbPisafSWULSODIosWLIfeqnBYwPRfPIzFL/yNt 4UYFNxSqh81kJeAcn3CiA9aSzpockL2inznJnyWU= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable In-Reply-To: <20200128072002.79250-7-brendanhiggins@google.com> References: <20200128072002.79250-1-brendanhiggins@google.com> <20200128072002.79250-7-brendanhiggins@google.com> From: Stephen Boyd Subject: Re: [PATCH v1 6/7] kunit: Add 'kunit_shutdown' option To: Brendan Higgins , akpm@linux-foundation.org, alan.maguire@oracle.com, anton.ivanov@cambridgegreys.com, arnd@arndb.de, davidgow@google.com, frowand.list@gmail.com, jdike@addtoit.com, keescook@chromium.org, richard@nod.at, rppt@linux.ibm.com, skhan@linuxfoundation.org, yzaikin@google.com Cc: gregkh@linuxfoundation.org, logang@deltatee.com, mcgrof@kernel.org, knut.omang@oracle.com, linux-um@lists.infradead.org, linux-arch@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, Brendan Higgins User-Agent: alot/0.8.1 Date: Tue, 28 Jan 2020 22:33:06 -0800 Message-Id: <20200129063307.19CB4206F0@mail.kernel.org> Sender: linux-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org Quoting Brendan Higgins (2020-01-27 23:20:01) > From: David Gow >=20 > 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. >=20 > 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 > =20 > #include > +#include Should this include come before kunit/test.h? I imagine the order of includes would be linux, kunit, local? > =20 > /* > * These symbols point to the .kunit_test_suites section and are defined= in > @@ -11,6 +12,23 @@ extern struct kunit_suite * const * const __kunit_suit= es_end[]; > =20 > #if IS_BUILTIN(CONFIG_KUNIT) > =20 > +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. > +} > + > static void kunit_print_tap_header(void) > { > struct kunit_suite * const * const *suites, * const *subsuite; From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iwguR-0004aH-J0 for linux-um@lists.infradead.org; Wed, 29 Jan 2020 06:33:08 +0000 MIME-Version: 1.0 In-Reply-To: <20200128072002.79250-7-brendanhiggins@google.com> References: <20200128072002.79250-1-brendanhiggins@google.com> <20200128072002.79250-7-brendanhiggins@google.com> From: Stephen Boyd Subject: Re: [PATCH v1 6/7] kunit: Add 'kunit_shutdown' option Date: Tue, 28 Jan 2020 22:33:06 -0800 Message-Id: <20200129063307.19CB4206F0@mail.kernel.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-um" Errors-To: linux-um-bounces+geert=linux-m68k.org@lists.infradead.org To: Brendan Higgins , akpm@linux-foundation.org, alan.maguire@oracle.com, anton.ivanov@cambridgegreys.com, arnd@arndb.de, davidgow@google.com, frowand.list@gmail.com, jdike@addtoit.com, keescook@chromium.org, richard@nod.at, rppt@linux.ibm.com, skhan@linuxfoundation.org, yzaikin@google.com Cc: linux-arch@vger.kernel.org, knut.omang@oracle.com, linux-doc@vger.kernel.org, gregkh@linuxfoundation.org, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, mcgrof@kernel.org, linux-kselftest@vger.kernel.org, logang@deltatee.com, Brendan Higgins , kunit-dev@googlegroups.com 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? > > /* > * 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. > +} > + > static void kunit_print_tap_header(void) > { > struct kunit_suite * const * const *suites, * const *subsuite; _______________________________________________ linux-um mailing list linux-um@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-um