aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/module.h
diff options
context:
space:
mode:
authorJeremy Kerr <jk@codeconstruct.com.au>2022-07-09 11:19:57 +0800
committerShuah Khan <skhan@linuxfoundation.org>2022-07-11 17:13:09 -0600
commit3d6e44623841c8b82c2157f2f749019803fb238a (patch)
tree1e1cc8314627520cc6f398fc684b5f3ac7a61fad /include/linux/module.h
parent8370b400f5abad168bcc541fa2574e7bd6b3bf2c (diff)
downloadlinux-3d6e44623841c8b82c2157f2f749019803fb238a.tar.gz
kunit: unify module and builtin suite definitions
Currently, KUnit runs built-in tests and tests loaded from modules differently. For built-in tests, the kunit_test_suite{,s}() macro adds a list of suites in the .kunit_test_suites linker section. However, for kernel modules, a module_init() function is used to run the test suites. This causes problems if tests are included in a module which already defines module_init/exit_module functions, as they'll conflict with the kunit-provided ones. This change removes the kunit-defined module inits, and instead parses the kunit tests from their own section in the module. After module init, we call __kunit_test_suites_init() on the contents of that section, which prepares and runs the suite. This essentially unifies the module- and non-module kunit init formats. Tested-by: MaĆ­ra Canal <maira.canal@usp.br> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au> Signed-off-by: Daniel Latypov <dlatypov@google.com> Signed-off-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'include/linux/module.h')
-rw-r--r--include/linux/module.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/linux/module.h b/include/linux/module.h
index abd9fa916b7d93..2490223c975d9b 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -505,6 +505,11 @@ struct module {
int num_static_call_sites;
struct static_call_site *static_call_sites;
#endif
+#if IS_ENABLED(CONFIG_KUNIT)
+ int num_kunit_suites;
+ struct kunit_suite ***kunit_suites;
+#endif
+
#ifdef CONFIG_LIVEPATCH
bool klp; /* Is this a livepatch module? */