Re: [PATCH v3 1/5] kunit: unify module and builtin suite definitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 9, 2022 at 2:23 AM Daniel Latypov <dlatypov@xxxxxxxxxx> wrote:
>
> On Fri, Jun 24, 2022 at 10:10 PM David Gow <davidgow@xxxxxxxxxx> 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@xxxxxxxxxx/
> I.e. We added in a MODULE_INFO(test, "Y") in this to-be-deleted section.

Nice catch. I've rebased this series on top of the taint stuff:
https://lore.kernel.org/linux-kselftest/20220709032001.819487-2-davidgow@xxxxxxxxxx/T/#u

> Perhaps something like this would be a fix?

Thanks.The rebased version is basically this, but without the #ifdef
MODULE indirection, as MODULE_INFO() will decay to nothing if MODULE
is not defined, anyway.

>   #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
> >

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux