diff options
| author | Ujwal Jain <ujwaljain@google.com> | 2025-06-14 16:47:11 +0800 |
|---|---|---|
| committer | Shuah Khan <skhan@linuxfoundation.org> | 2025-06-24 20:47:39 -0600 |
| commit | 63d0a9123120a2e10861ac7f6dc474bee653d3b2 (patch) | |
| tree | d44d503d9b923977c26298d5508cc09d885d6f5c /lib/kunit/try-catch-impl.h | |
| parent | e42ad39318dffbe46b05337759654c6436f723e8 (diff) | |
| download | linux-next-63d0a9123120a2e10861ac7f6dc474bee653d3b2.tar.gz linux-next-63d0a9123120a2e10861ac7f6dc474bee653d3b2.zip | |
kunit: Adjust kunit_test timeout based on test_{suite,case} speed
Currently, the in-kernel kunit test case timeout is 300 seconds. (There
is a separate timeout mechanism for the whole test execution in
kunit.py, but that's unrelated.) However, tests marked 'slow' or 'very
slow' may timeout, particularly on slower machines.
Implement a multiplier to the test-case timeout, so that slower tests
have longer to complete:
- DEFAULT -> 1x default timeout
- KUNIT_SPEED_SLOW -> 3x default timeout
- KUNIT_SPEED_VERY_SLOW -> 12x default timeout
A further change is planned to allow user configuration of the
default/base timeout to allow people with faster or slower machines to
adjust these to their use-cases.
Link: https://lore.kernel.org/r/20250614084711.2654593-2-davidgow@google.com
Signed-off-by: Ujwal Jain <ujwaljain@google.com>
Co-developed-by: David Gow <davidgow@google.com>
Signed-off-by: David Gow <davidgow@google.com>
Reviewed-by: Rae Moar <rmoar@google.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'lib/kunit/try-catch-impl.h')
| -rw-r--r-- | lib/kunit/try-catch-impl.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/kunit/try-catch-impl.h b/lib/kunit/try-catch-impl.h index 203ba6a5e740..6f401b97cd0b 100644 --- a/lib/kunit/try-catch-impl.h +++ b/lib/kunit/try-catch-impl.h @@ -17,11 +17,13 @@ struct kunit; static inline void kunit_try_catch_init(struct kunit_try_catch *try_catch, struct kunit *test, kunit_try_catch_func_t try, - kunit_try_catch_func_t catch) + kunit_try_catch_func_t catch, + unsigned long timeout) { try_catch->test = test; try_catch->try = try; try_catch->catch = catch; + try_catch->timeout = timeout; } #endif /* _KUNIT_TRY_CATCH_IMPL_H */ |
