lib: Add trivial kunit test for ratelimit
authorPaul E. McKenney <paulmck@kernel.org>
Thu, 3 Apr 2025 16:31:02 +0000 (09:31 -0700)
committerPaul E. McKenney <paulmck@kernel.org>
Tue, 24 Jun 2025 12:47:35 +0000 (05:47 -0700)
commitd19e9fa61f609978af9b03f1d20fa59dd8c9997d
tree56b010e2f2fd292b18886cdb8e8096539c53ced4
parent19272b37aa4f83ca52bdf9c16d5d81bdd1354494
lib: Add trivial kunit test for ratelimit

Add a simple single-threaded smoke test for lib/ratelimit.c

To run on x86:

make ARCH=x86_64 mrproper
./tools/testing/kunit/kunit.py run --arch x86_64 --kconfig_add CONFIG_RATELIMIT_KUNIT_TEST=y --kconfig_add CONFIG_SMP=y lib_ratelimit

This will fail on old ___ratelimit(), and subsequent patches provide
the fixes that are required.

[ paulmck:  Apply timeout and kunit feedback from Petr Mladek. ]

Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/
Link: https://lore.kernel.org/all/20250423115409.3425-1-spasswolf@web.de/
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: Mateusz Guzik <mjguzik@gmail.com>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Jon Pan-Doh <pandoh@google.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: Karolina Stolarek <karolina.stolarek@oracle.com>
lib/Kconfig.debug
lib/tests/Makefile
lib/tests/test_ratelimit.c [new file with mode: 0644]