[PATCH] char: misc: make miscdevice unit test require CONFIG_KUNIT=y

From: Thadeu Lima de Souza Cascardo
Date: Wed Apr 30 2025 - 07:30:47 EST


Otherwise, it allows for CONFIG_KUNIT=m, and that leads to build failures
like:

ld: drivers/misc/misc_minor_kunit.o: in function `miscdev_test_duplicate_minor':
misc_minor_kunit.c:(.text+0x180): undefined reference to `__kunit_do_failed_assertion'
ld: misc_minor_kunit.c:(.text+0x1e4): undefined reference to `__kunit_do_failed_assertion'
ld: misc_minor_kunit.c:(.text+0x240): undefined reference to `__kunit_do_failed_assertion'
ld: drivers/misc/misc_minor_kunit.o: in function `miscdev_test_twice':
misc_minor_kunit.c:(.text+0x3e8): undefined reference to `__kunit_do_failed_assertion'
ld: misc_minor_kunit.c:(.text+0x458): undefined reference to `__kunit_do_failed_assertion'
ld: drivers/misc/misc_minor_kunit.o:misc_minor_kunit.c:(.text+0x4c4): more undefined references to `__kunit_do_failed_assertion' follow
ld: drivers/misc/misc_minor_kunit.o: in function `miscdev_find_minors':
misc_minor_kunit.c:(.text+0xb3c): undefined reference to `kunit_log_append'
ld: misc_minor_kunit.c:(.text+0xbac): undefined reference to `kunit_log_append'
ld: misc_minor_kunit.c:(.text+0xc1c): undefined reference to `kunit_log_append'
ld: misc_minor_kunit.c:(.text+0xc88): undefined reference to `kunit_log_append'

[...]

Reported-by: Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx>
Closes: https://lore.kernel.org/linux-next/20250501164501.0fc0ab68@xxxxxxxxxxxxxxxx/
Fixes: 45f0de4f8dc3 ("char: misc: add test cases")
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@xxxxxxxxxx>
---
lib/Kconfig.debug | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index 0117b852bd13..4049851e5115 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2513,7 +2513,7 @@ config TEST_IDA

config TEST_MISC_MINOR
bool "miscdevice KUnit test" if !KUNIT_ALL_TESTS
- depends on KUNIT
+ depends on KUNIT=y
default KUNIT_ALL_TESTS
help
Kunit test for miscdevice API, specially its behavior in respect to
--
2.47.2