Commit 1b11063d authored by Daniel Latypov's avatar Daniel Latypov Committed by Shuah Khan

kunit: fix executor OOM error handling logic on non-UML

The existing logic happens to work fine on UML, but is not correct when
running on other arches.

1. We didn't initialize `int err`, and kunit_filter_suites() doesn't
   explicitly set it to 0 on success. So we had false "failures".
   Note: it doesn't happen on UML, causing this to get overlooked.
2. If we error out, we do not call kunit_handle_shutdown().
   This makes kunit.py timeout when using a non-UML arch, since the QEMU
   process doesn't ever exit.

Fixes: a02353f4 ("kunit: bail out of test filtering logic quicker if OOM")
Signed-off-by: default avatarDaniel Latypov <dlatypov@google.com>
Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
Signed-off-by: default avatarShuah Khan <skhan@linuxfoundation.org>
parent 8a7ccad3
...@@ -247,13 +247,13 @@ int kunit_run_all_tests(void) ...@@ -247,13 +247,13 @@ int kunit_run_all_tests(void)
.start = __kunit_suites_start, .start = __kunit_suites_start,
.end = __kunit_suites_end, .end = __kunit_suites_end,
}; };
int err; int err = 0;
if (filter_glob_param) { if (filter_glob_param) {
suite_set = kunit_filter_suites(&suite_set, filter_glob_param, &err); suite_set = kunit_filter_suites(&suite_set, filter_glob_param, &err);
if (err) { if (err) {
pr_err("kunit executor: error filtering suites: %d\n", err); pr_err("kunit executor: error filtering suites: %d\n", err);
return err; goto out;
} }
} }
...@@ -268,9 +268,10 @@ int kunit_run_all_tests(void) ...@@ -268,9 +268,10 @@ int kunit_run_all_tests(void)
kunit_free_suite_set(suite_set); kunit_free_suite_set(suite_set);
} }
kunit_handle_shutdown();
return 0; out:
kunit_handle_shutdown();
return err;
} }
#if IS_BUILTIN(CONFIG_KUNIT_TEST) #if IS_BUILTIN(CONFIG_KUNIT_TEST)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment