On Mon, Feb 10, 2025 at 10:00 AM Tamir Duberstein tamird@gmail.com wrote:
Convert the scanf() self-test to a KUnit test.
In the interest of keeping the patch reasonably-sized this doesn't refactor the tests into proper parameterized tests - it's all one big test case.
Acked-by: Petr Mladek pmladek@suse.com Reviewed-by: David Gow davidgow@google.com Signed-off-by: Tamir Duberstein tamird@gmail.com
MAINTAINERS | 2 +- lib/Kconfig.debug | 12 +- lib/Makefile | 2 +- lib/{test_scanf.c => scanf_kunit.c} | 228 ++++++++++++++++------------------- tools/testing/selftests/lib/Makefile | 2 +- tools/testing/selftests/lib/config | 1 - tools/testing/selftests/lib/scanf.sh | 4 - 7 files changed, 118 insertions(+), 133 deletions(-)
diff --git a/MAINTAINERS b/MAINTAINERS index 25c86f47353d..ab1d90c66c02 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -25411,8 +25411,8 @@ R: Sergey Senozhatsky senozhatsky@chromium.org S: Maintained T: git git://git.kernel.org/pub/scm/linux/kernel/git/printk/linux.git F: Documentation/core-api/printk-formats.rst +F: lib/scanf_kunit.c F: lib/test_printf.c -F: lib/test_scanf.c F: lib/vsprintf.c
VT1211 HARDWARE MONITOR DRIVER diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1af972a92d06..d35b60203856 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2427,6 +2427,15 @@ config ASYNC_RAID6_TEST config TEST_HEXDUMP tristate "Test functions located in the hexdump module at runtime"
+config SCANF_KUNIT_TEST
tristate "KUnit test scanf() family of functions at runtime" if !KUNIT_ALL_TESTS
depends on KUNIT
default KUNIT_ALL_TESTS
help
Enable this option to test the scanf functions at boot.
If unsure, say N.
Ugh, I meant to change this "at boot" to "at runtime".
Petr, if you are willing to take this through printf and apply this tiny edit, I'd really appreciate it.