diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/kunit/Kconfig | 11 | ||||
-rw-r--r-- | lib/kunit/kunit-test.c | 8 |
2 files changed, 15 insertions, 4 deletions
diff --git a/lib/kunit/Kconfig b/lib/kunit/Kconfig index 68a6daec0aef..34d7242d526d 100644 --- a/lib/kunit/Kconfig +++ b/lib/kunit/Kconfig @@ -24,6 +24,17 @@ config KUNIT_DEBUGFS test suite, which allow users to see results of the last test suite run that occurred. +config KUNIT_FAULT_TEST + bool "Enable KUnit tests which print BUG stacktraces" + depends on KUNIT_TEST + depends on !UML + default y + help + Enables fault handling tests for the KUnit framework. These tests may + trigger a kernel BUG(), and the associated stack trace, even when they + pass. If this conflicts with your test infrastrcture (or is confusing + or annoying), they can be disabled by setting this to N. + config KUNIT_TEST tristate "KUnit test for KUnit" if !KUNIT_ALL_TESTS default KUNIT_ALL_TESTS diff --git a/lib/kunit/kunit-test.c b/lib/kunit/kunit-test.c index 0fdca5fffaec..e3412e0ca399 100644 --- a/lib/kunit/kunit-test.c +++ b/lib/kunit/kunit-test.c @@ -109,7 +109,7 @@ static struct kunit_suite kunit_try_catch_test_suite = { .test_cases = kunit_try_catch_test_cases, }; -#ifndef CONFIG_UML +#if IS_ENABLED(CONFIG_KUNIT_FAULT_TEST) static void kunit_test_null_dereference(void *data) { @@ -136,12 +136,12 @@ static void kunit_test_fault_null_dereference(struct kunit *test) KUNIT_EXPECT_TRUE(test, ctx->function_called); } -#endif /* !CONFIG_UML */ +#endif /* CONFIG_KUNIT_FAULT_TEST */ static struct kunit_case kunit_fault_test_cases[] = { -#ifndef CONFIG_UML +#if IS_ENABLED(CONFIG_KUNIT_FAULT_TEST) KUNIT_CASE(kunit_test_fault_null_dereference), -#endif /* !CONFIG_UML */ +#endif /* CONFIG_KUNIT_FAULT_TEST */ {} }; |