Skip to content

Commit 1b11063

Browse files
dlatypovshuahkh
authored andcommitted
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: a02353f ("kunit: bail out of test filtering logic quicker if OOM") Signed-off-by: Daniel Latypov <[email protected]> Reviewed-by: Brendan Higgins <[email protected]> Signed-off-by: Shuah Khan <[email protected]>
1 parent 8a7ccad commit 1b11063

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

lib/kunit/executor.c

+5-4
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,13 @@ int kunit_run_all_tests(void)
247247
.start = __kunit_suites_start,
248248
.end = __kunit_suites_end,
249249
};
250-
int err;
250+
int err = 0;
251251

252252
if (filter_glob_param) {
253253
suite_set = kunit_filter_suites(&suite_set, filter_glob_param, &err);
254254
if (err) {
255255
pr_err("kunit executor: error filtering suites: %d\n", err);
256-
return err;
256+
goto out;
257257
}
258258
}
259259

@@ -268,9 +268,10 @@ int kunit_run_all_tests(void)
268268
kunit_free_suite_set(suite_set);
269269
}
270270

271-
kunit_handle_shutdown();
272271

273-
return 0;
272+
out:
273+
kunit_handle_shutdown();
274+
return err;
274275
}
275276

276277
#if IS_BUILTIN(CONFIG_KUNIT_TEST)

0 commit comments

Comments
 (0)