Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <pmladek@suse.com>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>

authored by

Petr Mladek and committed by
Paul E. McKenney
5a5c5a3d d19e9fa6

+4 -4
+4 -4
lib/tests/test_ratelimit.c
··· 24 24 test_ratelimited(test, true); 25 25 test_ratelimited(test, false); 26 26 27 - schedule_timeout_idle(TESTRL_INTERVAL - 40); 27 + schedule_timeout_idle(TESTRL_INTERVAL / 2); 28 28 test_ratelimited(test, false); 29 29 30 - schedule_timeout_idle(50); 30 + schedule_timeout_idle(TESTRL_INTERVAL * 3 / 4); 31 31 test_ratelimited(test, true); 32 32 33 33 schedule_timeout_idle(2 * TESTRL_INTERVAL); 34 34 test_ratelimited(test, true); 35 35 test_ratelimited(test, true); 36 36 37 - schedule_timeout_idle(TESTRL_INTERVAL - 40); 37 + schedule_timeout_idle(TESTRL_INTERVAL / 2 ); 38 38 test_ratelimited(test, true); 39 - schedule_timeout_idle(50); 39 + schedule_timeout_idle(TESTRL_INTERVAL * 3 / 4); 40 40 test_ratelimited(test, true); 41 41 test_ratelimited(test, true); 42 42 test_ratelimited(test, true);