mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ANDROID: GKI: Add ‘kunit.enable’ module parameter
kunit.enable when set to true will execute KUnit tests loaded via a module. Bug: 231160619 Signed-off-by: Joe Fradley <joefradley@google.com> Change-Id: I6d14a789292db2fffe437ce0e5aa099ebeafd06d
This commit is contained in:
@@ -52,6 +52,13 @@ void __kunit_fail_current_test(const char *file, int line, const char *fmt, ...)
|
||||
EXPORT_SYMBOL_GPL(__kunit_fail_current_test);
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Enable KUnit tests to run.
|
||||
*/
|
||||
static bool enable_param;
|
||||
module_param_named(enable, enable_param, bool, 0);
|
||||
MODULE_PARM_DESC(enable, "Enable KUnit tests to run");
|
||||
|
||||
/*
|
||||
* KUnit statistic mode:
|
||||
* 0 - disabled
|
||||
@@ -568,6 +575,12 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!enable_param) {
|
||||
pr_info("kunit: deactivated, cannot load %s\n",
|
||||
suites != NULL ? suites[0]->name : "NULL");
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; suites[i] != NULL; i++) {
|
||||
kunit_init_suite(suites[i]);
|
||||
kunit_run_tests(suites[i]);
|
||||
@@ -585,6 +598,9 @@ void __kunit_test_suites_exit(struct kunit_suite **suites)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!enable_param)
|
||||
return;
|
||||
|
||||
for (i = 0; suites[i] != NULL; i++)
|
||||
kunit_exit_suite(suites[i]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user