Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2305890ybl; Thu, 30 Jan 2020 15:10:17 -0800 (PST) X-Google-Smtp-Source: APXvYqxPKQmfuok0GNDd+IxS41YpA8DZvFInkFWFkrbq+jwqDoLym8xkr6pkA/N5+h9A4IJxI8X6 X-Received: by 2002:a9d:51c1:: with SMTP id d1mr5189289oth.136.1580425817793; Thu, 30 Jan 2020 15:10:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580425817; cv=none; d=google.com; s=arc-20160816; b=09heuJ05faFFZjalx+r7Q1lh1tHXAhUlR5fR0j0kJRPdd6Pjt9maWeKemz1rReCnTk HP6tiMQsSxl7g49VxtkOls0rsggrAv1nhbJ4anrWi3YZ6b2yvWJKcJoVxJmd08zvxLUG MWc7PPmQM+ezrN+1BnZJx6P7fCr19vCgF7WKCXu5OfrpOfq3AH2Q+xlT48wYYyYKaA7v smDqvzAygihHBqX3g6x9yW8QG24mRnMoAmfjzbkbkTJjvYpTj2NJprh4wVbzFssGAQTJ LGdHqMCsMSK36Y4YM2uQpytLFyCPKLhZB8DEJMgf+6A4FHiI13z6RYQ0pyZGmAMuPOX+ zL+A== 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=MP470Mm16Hbis3uK4k7c4Y0juRzNAQ4jaojQ4FBlGRU=; b=cGxmHN3lGU0Ro3lXlS6Hs1OUpSJdfvaDzda2uWWjwJ1RakOq2xxeXZw5sqOCvwQgQ8 vAbUkqFSMLstdey98m1cJQxacodWchIm4eyMj4sKLMunFKhrWx52R8Xpsag7bZuBr+Ks 89woV13hycGFjk0h9ibVT2rlGYvNozzPluLnj5+FtgaS0FunIm/mJgBID0K/Saw85Eyt WDfOV46EMJRz4WwrHS0i4RUCLfky1aX/ixm/boETTEjvYwco3vZsmdWn6TVhBpvVDmRG 7pm5eS8ZWqDzBxcrcW3UaSlws2qzxuO+8kDW9nsAGrRhZQHgOZttXF9NQH6tlu1oYGdA HSFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="qUKS4/bi"; 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 e14si4020470oti.33.2020.01.30.15.10.05; Thu, 30 Jan 2020 15:10:17 -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="qUKS4/bi"; 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 S1727745AbgA3XIl (ORCPT + 99 others); Thu, 30 Jan 2020 18:08:41 -0500 Received: from mail-pg1-f201.google.com ([209.85.215.201]:56075 "EHLO mail-pg1-f201.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727721AbgA3XIk (ORCPT ); Thu, 30 Jan 2020 18:08:40 -0500 Received: by mail-pg1-f201.google.com with SMTP id v30so2733258pga.22 for ; Thu, 30 Jan 2020 15:08:39 -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=MP470Mm16Hbis3uK4k7c4Y0juRzNAQ4jaojQ4FBlGRU=; b=qUKS4/biEzUnqRfVp6CMVb9g2VsQwQM5ss8wWgmxhAEh7N2VSqjHFRlpTPo/f7mWRg 9PO1MoSacP4zU4ZonpKGxOZYrEyppqNSUoXZa0FQt//aqOuXc89cbAvr0ezWDJ4GamtO BiZt1ehsxt7k4vkVItcppjb3GvfT1saAPVkTubBH/5WHPjLpLZrfNxtsAs4tlFqaM8Ct 0NQxiswyTirVUAHgkpirY4VdeJZ14+VcQUYvCB5Hq+v/C2MpCBLC95YavwPj0wL7qRwo 8DhYch1X7zqIrC958MLGmLeDXLdHjcpXcFAd8h8WSAOLOUVu7byljiU1Xi2E8Io7bhXC eiUg== 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=MP470Mm16Hbis3uK4k7c4Y0juRzNAQ4jaojQ4FBlGRU=; b=YmdEo8PyFyCWhPRdnx/rEwPvbWz5ArQ4+6WcaXtVm8+ieJzdaWVgnYeF7LLmxdk4rs FhidNVHbgJGNk/tb1pmVrWaXpkXpY83Y4eptFaGVLua3nJS0gBIoZHiOVK79ZupdC1rx gKSw0LgFULk7AufHSYdOvlP1/JPyVtUbHjDSjZWF+KlGyN1HEzo5KI4ggI+b8NJ9sBAQ l4cHV4GIR+zFLMf3fEeP28rNAaC5thQLpZ9bnN/lReav5jVos7lZF3uVuMBchma+S4WL Vdf1/XpVCRn9spfHRnyWKYlFezUb7gKWhdzgsHbE430uew6DkLcEGMpShMOU4YRwQ0rJ fi+A== X-Gm-Message-State: APjAAAVZ/KOrsxH1IFNTwCGm8p/0K7M0V4q3LMTcN5042x8Oxi8aWs74 SOI63Ph6sbuTfp4rrrFcn5Duhir8e5yyCsPjBgD9mw== X-Received: by 2002:a63:4503:: with SMTP id s3mr7221610pga.311.1580425719434; Thu, 30 Jan 2020 15:08:39 -0800 (PST) Date: Thu, 30 Jan 2020 15:08:09 -0800 In-Reply-To: <20200130230812.142642-1-brendanhiggins@google.com> Message-Id: <20200130230812.142642-5-brendanhiggins@google.com> Mime-Version: 1.0 References: <20200130230812.142642-1-brendanhiggins@google.com> X-Mailer: git-send-email 2.25.0.341.g760bfbb309-goog Subject: [PATCH v2 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, 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 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 2cd736059416f..90301d4fbd1bb 100644 --- a/init/main.c +++ b/init/main.c @@ -103,6 +103,8 @@ #define CREATE_TRACE_POINTS #include +#include + static int kernel_init(void *); extern void init_IRQ(void); @@ -1201,6 +1203,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.0.341.g760bfbb309-goog