Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp122105ybf; Thu, 27 Feb 2020 17:22:31 -0800 (PST) X-Google-Smtp-Source: APXvYqwrMeaO+V1wBJnt2+vm3PYE2Q4br5Z85XVpHV98r5yHB1kQ5cJLQWCuhYdbDPDhb07zCo7O X-Received: by 2002:a05:6830:1011:: with SMTP id a17mr1342543otp.45.1582852950999; Thu, 27 Feb 2020 17:22:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582852950; cv=none; d=google.com; s=arc-20160816; b=FGJqSvWhvjyXVL24ukwXjV6nUob5WqnHTFcqn38VypAcPeUymri0AdoiCU8oeRtrd8 djHZKrjPpINB6y9psE1I6x6Ks5pyxCpy7QUCDGnkxjTP0FGoLK9fV9QeenKJPNkH2D3G rrgwYREcczuPGCSTt1z5+EJ335PTxxLqTlwmUJ3l1apC52Owo0/E3W34HsJp8Yuptgt4 n6yLAozmrwTUwZL0/XJYhG54CP7Tqkst41nGHJDqlfmiO5/8wuzdljdzkdhYhtF2R4et o6cutHtKgqIblrAFXt11EdYXsEOCyvEmmcMGrw2Rghg+89uYevzSHPx454//YU9hEEDl QwRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:from:subject:references :mime-version:message-id:in-reply-to:date:dkim-signature; bh=8lHd0YZkwZG2tzVOdxbzliRdb15FJbxx1Rjn1yB5+70=; b=K2QqFVx2I7zmxX+V9ZUA734TS+hyx1Y3CIIXyJ2MOm99iitelSn8mmFMyhiKldrjDf Ui2ty2P15q3D3kiiPWbaR/OQfQTB6VRsUE9asL9rDC90JDcYA8eL2wiW//wPW5Albf9q aQzElQ9aA6hvDIJRyT4DZ0NCfcprjr68BWt2YBzIMSXpXAI2OsI9dbNjP5piXRyOjsws 7dDN24SLnGSu0qEcdp5jkmFUk1eZTw2wcMEN36MJT8VejuSrmMpRgDfb4tOjtzcDZ8tm AdCl3aMEs4iWu91iIw5N/cIWMCmAUHU3khVrzzAZrC9bksqt9VrqouN/kk2/aJkppSoU QCDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Bty/Q2oV"; 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 o1si582318otk.154.2020.02.27.17.22.19; Thu, 27 Feb 2020 17:22:30 -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="Bty/Q2oV"; 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 S1730652AbgB1BVJ (ORCPT + 99 others); Thu, 27 Feb 2020 20:21:09 -0500 Received: from mail-pg1-f201.google.com ([209.85.215.201]:47580 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730640AbgB1BVI (ORCPT ); Thu, 27 Feb 2020 20:21:08 -0500 Received: by mail-pg1-f201.google.com with SMTP id l15so722031pgk.14 for ; Thu, 27 Feb 2020 17:21:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=8lHd0YZkwZG2tzVOdxbzliRdb15FJbxx1Rjn1yB5+70=; b=Bty/Q2oVTN47foIGrI34kAsL9y3zp5FC92Tuh2vIv90lA66BfzLsxq5CRGdQbuTU/V n9fsZay5lgeSnvTqrjeQFbuDLt8lGR8C8QILxlmjfijeVL9WgNaefmZfmv/doN7k5/S8 KDIo01iFyP9kibL/VroPQ24eUBVXE2M+B5HjmVxniWizwDLZv8WhkeLTRcTVx2Dtg/pA ASEMv/Lpre04igKn6rhqAcPph95bj91sQcBUU9tgeRwUFrU2REdGiZETCN6W1ZkhBUr4 XN7JrUYawuanT9NktwcCxIrp78dZRMo5IxQc8AD4YNi8wC1H11QUDW5GjX6zndj+Wze/ 4MGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=8lHd0YZkwZG2tzVOdxbzliRdb15FJbxx1Rjn1yB5+70=; b=SXnrz9ZsVbDyRiu8vyQyCdw2uQbBIx/FqPxzOBUUf0DLR6txbsCJyDHNYDzbA3f4hy /ZvTqTwxfNOp5liEcxsDE9Q5n6Pr47SkP0PYY8TNC59TtD+OhhroqgJEjszQfuq0h86k L2h1U6e9RD92zzW0TzOKlUcFe2ezoOPxrUorxJQFzayzIjr19owoOJr7dhrwtMVtpYF1 8cZaDfTGLI5LQZlY2BvnBDMxnIJDXIQMHG/bQmlHxX//GYbk9xDoNjrb/gTbIFld/YCw s/sonI3v82yc5iDL0ZH5UdTz7H4I6VXSPli/J+vnI7vyxD9SHdlNAwsU5xSV4xZQ9E98 FsPg== X-Gm-Message-State: APjAAAVn37DZP1y6lir6qjjGdWg4pob9lRbqEMoZ8a8G8YU/GqGajlZP ZFMaGr/Xc9ro8S8Vm0h7NTvvgDxelVFwn29rKbFPVQ== X-Received: by 2002:a63:b949:: with SMTP id v9mr2010452pgo.336.1582852865540; Thu, 27 Feb 2020 17:21:05 -0800 (PST) Date: Thu, 27 Feb 2020 17:20:33 -0800 In-Reply-To: <20200228012036.15682-1-brendanhiggins@google.com> Message-Id: <20200228012036.15682-5-brendanhiggins@google.com> Mime-Version: 1.0 References: <20200228012036.15682-1-brendanhiggins@google.com> X-Mailer: git-send-email 2.25.1.481.gfbce0eb801-goog Subject: [PATCH v3 4/7] init: main: add KUnit to kernel init From: Brendan Higgins To: jdike@addtoit.com, richard@nod.at, anton.ivanov@cambridgegreys.com, arnd@arndb.de, keescook@chromium.org, skhan@linuxfoundation.org, alan.maguire@oracle.com, yzaikin@google.com, davidgow@google.com, akpm@linux-foundation.org, rppt@linux.ibm.com, frowand.list@gmail.com Cc: gregkh@linuxfoundation.org, sboyd@kernel.org, logang@deltatee.com, mcgrof@kernel.org, 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 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 Remove KUnit from init calls entirely, instead call directly from kernel_init(). Co-developed-by: Alan Maguire Signed-off-by: Alan Maguire Signed-off-by: Brendan Higgins Reviewed-by: Stephen Boyd --- include/kunit/test.h | 9 +++++++++ init/main.c | 4 ++++ lib/kunit/executor.c | 4 +--- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/kunit/test.h b/include/kunit/test.h index 8a02f93a6b505..8689dd1459844 100644 --- a/include/kunit/test.h +++ b/include/kunit/test.h @@ -197,6 +197,15 @@ void kunit_init_test(struct kunit *test, const char *name); int kunit_run_tests(struct kunit_suite *suite); +#if IS_BUILTIN(CONFIG_KUNIT) +int kunit_run_all_tests(void); +#else +static inline int kunit_run_all_tests(void) +{ + return 0; +} +#endif /* IS_BUILTIN(CONFIG_KUNIT) */ + /* * If a test suite is built-in, module_init() gets translated into * an initcall which we don't want as the idea is that for builtins diff --git a/init/main.c b/init/main.c index ee4947af823f3..7875a5c486dc4 100644 --- a/init/main.c +++ b/init/main.c @@ -104,6 +104,8 @@ #define CREATE_TRACE_POINTS #include +#include + static int kernel_init(void *); extern void init_IRQ(void); @@ -1444,6 +1446,8 @@ static noinline void __init kernel_init_freeable(void) do_basic_setup(); + kunit_run_all_tests(); + console_on_rootfs(); /* diff --git a/lib/kunit/executor.c b/lib/kunit/executor.c index 6429927d598a5..b75a46c560847 100644 --- a/lib/kunit/executor.c +++ b/lib/kunit/executor.c @@ -11,7 +11,7 @@ extern struct kunit_suite * const * const __kunit_suites_end[]; #if IS_BUILTIN(CONFIG_KUNIT) -static int kunit_run_all_tests(void) +int kunit_run_all_tests(void) { struct kunit_suite * const * const *suites, * const *subsuite; bool has_test_failed = false; @@ -31,6 +31,4 @@ static int kunit_run_all_tests(void) return 0; } -late_initcall(kunit_run_all_tests); - #endif /* IS_BUILTIN(CONFIG_KUNIT) */ -- 2.25.1.481.gfbce0eb801-goog