diff options
| author | Kees Cook <kees@kernel.org> | 2025-07-17 01:52:12 -0700 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2025-07-19 23:03:24 -0700 |
| commit | fc07839203f3b98fa9afac370aaba283afc10433 (patch) | |
| tree | bdd72f4989afe59e96d4b1510b0829378f4d0d0d /lib/Kconfig.debug | |
| parent | 2d8ae9a4f1bc04a118e3d438ac50dd49281b34fd (diff) | |
seq_buf: Introduce KUnit tests
Add KUnit tests for the seq_buf API to ensure its correctness and
prevent future regressions, covering the following functions:
- seq_buf_init()
- DECLARE_SEQ_BUF()
- seq_buf_clear()
- seq_buf_puts()
- seq_buf_putc()
- seq_buf_printf()
- seq_buf_get_buf()
- seq_buf_commit()
$ tools/testing/kunit/kunit.py run seq_buf
=================== seq_buf (9 subtests) ===================
[PASSED] seq_buf_init_test
[PASSED] seq_buf_declare_test
[PASSED] seq_buf_clear_test
[PASSED] seq_buf_puts_test
[PASSED] seq_buf_puts_overflow_test
[PASSED] seq_buf_putc_test
[PASSED] seq_buf_printf_test
[PASSED] seq_buf_printf_overflow_test
[PASSED] seq_buf_get_buf_commit_test
===================== [PASSED] seq_buf =====================
Link: https://lore.kernel.org/r/20250717085156.work.363-kees@kernel.org
Reviewed-by: David Gow <davidgow@google.com>
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'lib/Kconfig.debug')
| -rw-r--r-- | lib/Kconfig.debug | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ebe33181b6e6..087beae1e8fb 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -2460,6 +2460,15 @@ config SCANF_KUNIT_TEST If unsure, say N. +config SEQ_BUF_KUNIT_TEST + tristate "KUnit test for seq_buf" if !KUNIT_ALL_TESTS + depends on KUNIT + default KUNIT_ALL_TESTS + help + This builds unit tests for the seq_buf library. + + If unsure, say N. + config STRING_KUNIT_TEST tristate "KUnit test string functions at runtime" if !KUNIT_ALL_TESTS depends on KUNIT |