[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGS_qxrGwVL37AOUWCxwx=qg6YvXCDSSu4p_PSt7_87N3RxJZw@mail.gmail.com>
Date: Fri, 8 Jul 2022 11:23:08 -0700
From: Daniel Latypov <dlatypov@...gle.com>
To: David Gow <davidgow@...gle.com>
Cc: Brendan Higgins <brendanhiggins@...gle.com>,
Luis Chamberlain <mcgrof@...nel.org>,
Jeremy Kerr <jk@...econstruct.com.au>,
Shuah Khan <skhan@...uxfoundation.org>,
Andrew Jeffery <andrew@...id.au>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andra Paraschiv <andraprs@...zon.com>,
Longpeng <longpeng2@...wei.com>,
Greg KH <gregkh@...uxfoundation.org>,
kunit-dev@...glegroups.com, linux-kselftest@...r.kernel.org,
linux-kernel@...r.kernel.org,
MaĆra Canal <maira.canal@....br>,
linux-mmc@...r.kernel.org, linux-aspeed@...ts.ozlabs.org,
openbmc@...ts.ozlabs.org, linux-usb@...r.kernel.org,
linux-modules@...r.kernel.org,
Matt Johnston <matt@...econstruct.com.au>
Subject: Re: [PATCH v3 1/5] kunit: unify module and builtin suite definitions
On Fri, Jun 24, 2022 at 10:10 PM David Gow <davidgow@...gle.com> wrote:
> diff --git a/include/kunit/test.h b/include/kunit/test.h
> index 8ffcd7de9607..54306271cfbf 100644
> --- a/include/kunit/test.h
> +++ b/include/kunit/test.h
> @@ -250,41 +250,8 @@ static inline int kunit_run_all_tests(void)
> }
> #endif /* IS_BUILTIN(CONFIG_KUNIT) */
>
> -#ifdef MODULE
> -/**
> - * kunit_test_suites_for_module() - used to register one or more
> - * &struct kunit_suite with KUnit.
> - *
> - * @__suites: a statically allocated list of &struct kunit_suite.
> - *
> - * Registers @__suites with the test framework. See &struct kunit_suite for
> - * more information.
> - *
> - * 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
> - * the executor will manage execution. So ensure we do not define
> - * module_{init|exit} functions for the builtin case when registering
> - * suites via kunit_test_suites() below.
> - */
> -#define kunit_test_suites_for_module(__suites) \
Deleting this bit now causes merge conflicts with Shuah's kunit
branch, due to https://patchwork.kernel.org/project/linux-kselftest/patch/20220702040959.3232874-3-davidgow@google.com/
I.e. We added in a MODULE_INFO(test, "Y") in this to-be-deleted section.
Perhaps something like this would be a fix?
#ifdef MODULE
#define _kunit_mark_test_module MODULE_INFO(test, "Y")
#else
#define _kunit_mark_test_module
#endif /* MODULE */
#define __kunit_test_suites(unique_array, unique_suites, ...)
\
_kunit_mark_test_module;
\
static struct kunit_suite *unique_array[] = { __VA_ARGS__,
NULL }; \
static struct kunit_suite **unique_suites
\
__used __section(".kunit_test_suites") = unique_array
> - static int __init kunit_test_suites_init(void) \
> - { \
> - return __kunit_test_suites_init(__suites); \
> - } \
> - module_init(kunit_test_suites_init); \
> - \
> - static void __exit kunit_test_suites_exit(void) \
> - { \
> - return __kunit_test_suites_exit(__suites); \
> - } \
> - module_exit(kunit_test_suites_exit)
> -#else
> -#define kunit_test_suites_for_module(__suites)
> -#endif /* MODULE */
> -
> #define __kunit_test_suites(unique_array, unique_suites, ...) \
> static struct kunit_suite *unique_array[] = { __VA_ARGS__, NULL }; \
> - kunit_test_suites_for_module(unique_array); \
> static struct kunit_suite **unique_suites \
> __used __section(".kunit_test_suites") = unique_array
>
Powered by blists - more mailing lists