-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
kunit: test: create a single centralized executor for all tests
Add a centralized executor to dispatch tests rather than relying on late_initcall to schedule each test suite separately. Centralized execution is for built-in tests only; modules will execute tests when loaded. Signed-off-by: Alan Maguire <alan.maguire@oracle.com> Co-developed-by: Iurii Zaikin <yzaikin@google.com> Signed-off-by: Iurii Zaikin <yzaikin@google.com> Co-developed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Brendan Higgins <brendanhiggins@google.com> Reviewed-by: Stephen Boyd <sboyd@kernel.org> Reviewed-by: Kees Cook <keescook@chromium.org> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
- Loading branch information
Alan Maguire
authored and
Shuah Khan
committed
Oct 9, 2020
1 parent
90a025a
commit aac3546
Showing
4 changed files
with
76 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// 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) | ||
|
||
static 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; | ||
} | ||
|
||
late_initcall(kunit_run_all_tests); | ||
|
||
#endif /* IS_BUILTIN(CONFIG_KUNIT) */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters