kunit: test: create a single centralized executor for all tests
[linux-2.6-microblaze.git] / lib / kunit / executor.c
1 // SPDX-License-Identifier: GPL-2.0
2
3 #include <kunit/test.h>
4
5 /*
6  * These symbols point to the .kunit_test_suites section and are defined in
7  * include/asm-generic/vmlinux.lds.h, and consequently must be extern.
8  */
9 extern struct kunit_suite * const * const __kunit_suites_start[];
10 extern struct kunit_suite * const * const __kunit_suites_end[];
11
12 #if IS_BUILTIN(CONFIG_KUNIT)
13
14 static int kunit_run_all_tests(void)
15 {
16         struct kunit_suite * const * const *suites;
17
18         for (suites = __kunit_suites_start;
19              suites < __kunit_suites_end;
20              suites++)
21                         __kunit_test_suites_init(*suites);
22
23         return 0;
24 }
25
26 late_initcall(kunit_run_all_tests);
27
28 #endif /* IS_BUILTIN(CONFIG_KUNIT) */