linux-kselftest.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Latypov <dlatypov@google.com>
To: David Gow <davidgow@google.com>
Cc: "Brendan Higgins" <brendanhiggins@google.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Jeremy Kerr" <jk@codeconstruct.com.au>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>,
	"Andra Paraschiv" <andraprs@amazon.com>,
	Longpeng <longpeng2@huawei.com>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	kunit-dev@googlegroups.com, linux-kselftest@vger.kernel.org,
	linux-kernel@vger.kernel.org, "Maíra Canal" <maira.canal@usp.br>,
	linux-mmc@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
	openbmc@lists.ozlabs.org, linux-usb@vger.kernel.org,
	linux-modules@vger.kernel.org,
	"Matt Johnston" <matt@codeconstruct.com.au>
Subject: Re: [PATCH v3 1/5] kunit: unify module and builtin suite definitions
Date: Fri, 8 Jul 2022 11:23:08 -0700	[thread overview]
Message-ID: <CAGS_qxrGwVL37AOUWCxwx=qg6YvXCDSSu4p_PSt7_87N3RxJZw@mail.gmail.com> (raw)
In-Reply-To: <20220625050838.1618469-2-davidgow@google.com>

On Fri, Jun 24, 2022 at 10:10 PM David Gow <davidgow@google.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
>

  parent reply	other threads:[~2022-07-08 18:23 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-25  5:08 [PATCH v3 0/5] Rework KUnit test execution in modules David Gow
2022-06-25  5:08 ` [PATCH v3 1/5] kunit: unify module and builtin suite definitions David Gow
2022-07-06 21:05   ` Brendan Higgins
2022-07-08 18:23   ` Daniel Latypov [this message]
2022-07-09  3:25     ` David Gow
2022-06-25  5:08 ` [PATCH v3 2/5] kunit: flatten kunit_suite*** to kunit_suite** in .kunit_test_suites David Gow
2022-07-06 21:15   ` Brendan Higgins
2022-06-25  5:08 ` [PATCH v3 3/5] thunderbolt: test: Use kunit_test_suite() macro David Gow
2022-07-06 21:19   ` Brendan Higgins
2022-06-25  5:08 ` [PATCH v3 4/5] nitro_enclaves: " David Gow
2022-07-06 21:21   ` Brendan Higgins
2022-06-25  5:08 ` [PATCH v3 5/5] mmc: sdhci-of-aspeed: " David Gow
2022-07-06 21:24   ` Brendan Higgins

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGS_qxrGwVL37AOUWCxwx=qg6YvXCDSSu4p_PSt7_87N3RxJZw@mail.gmail.com' \
    --to=dlatypov@google.com \
    --cc=andraprs@amazon.com \
    --cc=andrew@aj.id.au \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jk@codeconstruct.com.au \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=longpeng2@huawei.com \
    --cc=maira.canal@usp.br \
    --cc=matt@codeconstruct.com.au \
    --cc=mcgrof@kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=skhan@linuxfoundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).