]> git.ipfire.org Git - thirdparty/linux.git/commit
kunit: Add backtrace suppression self-tests
authorGuenter Roeck <linux@roeck-us.net>
Thu, 14 May 2026 11:06:38 +0000 (13:06 +0200)
committerShuah Khan <skhan@linuxfoundation.org>
Thu, 14 May 2026 16:50:00 +0000 (10:50 -0600)
commitbbc960d009a6315f484944506bbb13165069ccc8
tree704d9e7ec7e607934d538ed0d940bb2f6870a83b
parent85347718ab0dd7ede9c3e1dcff2d604c7073df05
kunit: Add backtrace suppression self-tests

Add unit tests to verify that warning backtrace suppression works.

Tests cover both API forms:
- Scoped: kunit_warning_suppress() with in-block count verification
  and post-block inactivity check.
- Direct functions: kunit_start/end_suppress_warning() with
  sequential independent suppression blocks and per-block counts.

Furthermore, tests verify incremental warning counting, that
kunit_has_active_suppress_warning() transitions correctly around
suppression boundaries, and that suppression active in the test
kthread does not leak to a separate kthread.

If backtrace suppression does _not_ work, the unit tests will likely
trigger unsuppressed backtraces, which should actually help to get
the affected architectures / platforms fixed.

Link: https://lore.kernel.org/r/20260514-kunit_add_support-v11-2-b36a530a6d8f@redhat.com
Tested-by: Linux Kernel Functional Testing <lkft@linaro.org>
Acked-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Alessandro Carminati <acarmina@redhat.com>
Reviewed-by: David Gow <david@davidgow.net>
Signed-off-by: Albert Esteve <aesteve@redhat.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
lib/kunit/Makefile
lib/kunit/backtrace-suppression-test.c [new file with mode: 0644]