Skip to content

Commit 7178f6f

Browse files
l0kodshuahkh
authored andcommitted
kunit: Fix timeout message
The exit code is always checked, so let's properly handle the -ETIMEDOUT error code. Cc: Brendan Higgins <brendanhiggins@google.com> Cc: Shuah Khan <skhan@linuxfoundation.org> Reviewed-by: Kees Cook <keescook@chromium.org> Reviewed-by: David Gow <davidgow@google.com> Reviewed-by: Rae Moar <rmoar@google.com> Signed-off-by: Mickaël Salaün <mic@digikod.net> Link: https://lore.kernel.org/r/20240408074625.65017-4-mic@digikod.net Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
1 parent 0e57f89 commit 7178f6f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/kunit/try-catch.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)
7979
time_remaining = wait_for_completion_timeout(&try_completion,
8080
kunit_test_timeout());
8181
if (time_remaining == 0) {
82-
kunit_err(test, "try timed out\n");
8382
try_catch->try_result = -ETIMEDOUT;
8483
kthread_stop(task_struct);
8584
}
@@ -94,6 +93,8 @@ void kunit_try_catch_run(struct kunit_try_catch *try_catch, void *context)
9493
try_catch->try_result = 0;
9594
else if (exit_code == -EINTR)
9695
kunit_err(test, "wake_up_process() was never called\n");
96+
else if (exit_code == -ETIMEDOUT)
97+
kunit_err(test, "try timed out\n");
9798
else if (exit_code)
9899
kunit_err(test, "Unknown error: %d\n", exit_code);
99100

0 commit comments

Comments
 (0)