Skip to content

Commit 5a5c5a3

Browse files
pmladekpaulmckrcu
authored andcommitted
lib: Make the ratelimit test more reliable
The selftest fails most of the times when running in qemu with a kernel configured with CONFIG_HZ = 250: > test_ratelimit_smoke: 1 callbacks suppressed > # test_ratelimit_smoke: ASSERTION FAILED at lib/tests/test_ratelimit.c:28 > Expected ___ratelimit(&testrl, "test_ratelimit_smoke") == (false), but > ___ratelimit(&testrl, "test_ratelimit_smoke") == 1 (0x1) > (false) == 0 (0x0) Try to make the test slightly more reliable by calling the problematic ratelimit in the middle of the interval. Signed-off-by: Petr Mladek <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent d19e9fa commit 5a5c5a3

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/tests/test_ratelimit.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,19 @@ static void test_ratelimit_smoke(struct kunit *test)
2424
test_ratelimited(test, true);
2525
test_ratelimited(test, false);
2626

27-
schedule_timeout_idle(TESTRL_INTERVAL - 40);
27+
schedule_timeout_idle(TESTRL_INTERVAL / 2);
2828
test_ratelimited(test, false);
2929

30-
schedule_timeout_idle(50);
30+
schedule_timeout_idle(TESTRL_INTERVAL * 3 / 4);
3131
test_ratelimited(test, true);
3232

3333
schedule_timeout_idle(2 * TESTRL_INTERVAL);
3434
test_ratelimited(test, true);
3535
test_ratelimited(test, true);
3636

37-
schedule_timeout_idle(TESTRL_INTERVAL - 40);
37+
schedule_timeout_idle(TESTRL_INTERVAL / 2 );
3838
test_ratelimited(test, true);
39-
schedule_timeout_idle(50);
39+
schedule_timeout_idle(TESTRL_INTERVAL * 3 / 4);
4040
test_ratelimited(test, true);
4141
test_ratelimited(test, true);
4242
test_ratelimited(test, true);

0 commit comments

Comments
 (0)