mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 17:08:10 +00:00
8c0d884986
Although we have not seen any actual examples where KUnit doesn't work because it runs in the late init phase of the kernel, it has been a concern for some time that this could potentially be an issue in the future. So, remove KUnit from init calls entirely, instead call directly from kernel_init() so that KUnit runs after late init. Co-developed-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Signed-off-by: Brendan Higgins <brendanhiggins@google.com> Reviewed-by: Stephen Boyd <sboyd@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
26 lines
634 B
C
26 lines
634 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include <kunit/test.h>
|
|
|
|
/*
|
|
* These symbols point to the .kunit_test_suites section and are defined in
|
|
* include/asm-generic/vmlinux.lds.h, and consequently must be extern.
|
|
*/
|
|
extern struct kunit_suite * const * const __kunit_suites_start[];
|
|
extern struct kunit_suite * const * const __kunit_suites_end[];
|
|
|
|
#if IS_BUILTIN(CONFIG_KUNIT)
|
|
|
|
int kunit_run_all_tests(void)
|
|
{
|
|
struct kunit_suite * const * const *suites;
|
|
|
|
for (suites = __kunit_suites_start;
|
|
suites < __kunit_suites_end;
|
|
suites++)
|
|
__kunit_test_suites_init(*suites);
|
|
|
|
return 0;
|
|
}
|
|
|
|
#endif /* IS_BUILTIN(CONFIG_KUNIT) */
|