mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-12-29 09:16:33 +00:00
kunit: bail out early in __kunit_test_suites_init() if there are no suites to test
[ Upstream commit5496b9b77d
] Commitc72a870926
added a mutex to prevent kunit tests from running concurrently. Unfortunately that mutex gets locked during module load regardless of whether the module actually has any kunit tests. This causes a problem for kunit tests that might need to load other kernel modules (e.g. gss_krb5_test loading the camellia module). So check to see if there are actually any tests to run before locking the kunit_run_lock mutex. Fixes:c72a870926
("kunit: add ability to run tests after boot using debugfs") Reported-by: Nico Pache <npache@redhat.com> Signed-off-by: Scott Mayhew <smayhew@redhat.com> Reviewed-by: Rae Moar <rmoar@google.com> Reviewed-by: David Gow <davidgow@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
67364ec521
commit
a5ac124bdd
@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (num_suites == 0)
|
||||
return 0;
|
||||
|
||||
if (!kunit_enabled() && num_suites > 0) {
|
||||
pr_info("kunit: disabled\n");
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user