Skip to content

Commit 53026ff

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 <[email protected]> Cc: Shuah Khan <[email protected]> Reviewed-by: Kees Cook <[email protected]> Reviewed-by: David Gow <[email protected]> Reviewed-by: Rae Moar <[email protected]> Signed-off-by: Mickaël Salaün <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Shuah Khan <[email protected]>
1 parent f8aa1b9 commit 53026ff

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)