Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

lib: Move KUnit tests into tests/ subdirectory

Following from the recent KUnit file naming discussion[1], move all
KUnit tests in lib/ into lib/tests/.

Link: https://lore.kernel.org/lkml/20240720165441.it.320-kees@kernel.org/ [1]
Acked-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Acked-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: David Gow <davidgow@google.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Rae Moar <rmoar@google.com>
Link: https://lore.kernel.org/r/20241202075545.3648096-4-davidgow@google.com
Signed-off-by: Kees Cook <kees@kernel.org>

+51 -47
+10 -9
MAINTAINERS
··· 4017 4017 F: lib/bitmap-str.c 4018 4018 F: lib/bitmap.c 4019 4019 F: lib/cpumask.c 4020 - F: lib/cpumask_kunit.c 4021 4020 F: lib/find_bit.c 4022 4021 F: lib/find_bit_benchmark.c 4023 4022 F: lib/test_bitmap.c 4023 + F: lib/tests/cpumask_kunit.c 4024 4024 F: tools/include/linux/bitfield.h 4025 4025 F: tools/include/linux/bitmap.h 4026 4026 F: tools/include/linux/bits.h ··· 9065 9065 S: Supported 9066 9066 T: git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening 9067 9067 F: include/linux/fortify-string.h 9068 - F: lib/fortify_kunit.c 9069 - F: lib/memcpy_kunit.c 9070 9068 F: lib/test_fortify/* 9069 + F: lib/tests/fortify_kunit.c 9070 + F: lib/tests/memcpy_kunit.c 9071 + F: scripts/test_fortify.sh 9071 9072 K: \bunsafe_memcpy\b 9072 9073 K: \b__NO_FORTIFY\b 9073 9074 ··· 9756 9755 F: include/linux/string_choices.h 9757 9756 F: include/linux/string_helpers.h 9758 9757 F: lib/string.c 9759 - F: lib/string_kunit.c 9760 9758 F: lib/string_helpers.c 9761 - F: lib/string_helpers_kunit.c 9759 + F: lib/tests/string_helpers_kunit.c 9760 + F: lib/tests/string_kunit.c 9762 9761 F: scripts/coccinelle/api/string_choices.cocci 9763 9762 9764 9763 GENERIC UIO DRIVER FOR PCI DEVICES ··· 12986 12985 F: include/asm-generic/kprobes.h 12987 12986 F: include/linux/kprobes.h 12988 12987 F: kernel/kprobes.c 12989 - F: lib/test_kprobes.c 12988 + F: lib/tests/test_kprobes.c 12990 12989 F: samples/kprobes 12991 12990 12992 12991 KS0108 LCD CONTROLLER DRIVER ··· 13316 13315 R: Matti Vaittinen <mazziesaccount@gmail.com> 13317 13316 F: include/linux/linear_range.h 13318 13317 F: lib/linear_ranges.c 13319 - F: lib/test_linear_ranges.c 13318 + F: lib/tests/test_linear_ranges.c 13320 13319 13321 13320 LINUX FOR POWER MACINTOSH 13322 13321 L: linuxppc-dev@lists.ozlabs.org ··· 13444 13443 L: linux-kselftest@vger.kernel.org 13445 13444 L: kunit-dev@googlegroups.com 13446 13445 S: Maintained 13447 - F: lib/list-test.c 13446 + F: lib/tests/list-test.c 13448 13447 13449 13448 LITEX PLATFORM 13450 13449 M: Karol Gugala <kgugala@antmicro.com> ··· 21733 21732 S: Maintained 21734 21733 F: include/linux/siphash.h 21735 21734 F: lib/siphash.c 21736 - F: lib/siphash_kunit.c 21735 + F: lib/tests/siphash_kunit.c 21737 21736 21738 21737 SIS 190 ETHERNET DRIVER 21739 21738 M: Francois Romieu <romieu@fr.zoreil.com>
+1 -38
lib/Makefile
··· 52 52 percpu-refcount.o rhashtable.o base64.o \ 53 53 once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \ 54 54 generic-radix-tree.o bitmap-str.o 55 - obj-$(CONFIG_STRING_KUNIT_TEST) += string_kunit.o 56 55 obj-y += string_helpers.o 57 - obj-$(CONFIG_STRING_HELPERS_KUNIT_TEST) += string_helpers_kunit.o 58 56 obj-y += hexdump.o 59 57 obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o 60 58 obj-y += kstrtox.o ··· 63 65 obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o 64 66 obj-$(CONFIG_TEST_BITOPS) += test_bitops.o 65 67 CFLAGS_test_bitops.o += -Werror 66 - obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o 67 68 obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o 68 - obj-$(CONFIG_TEST_IOV_ITER) += kunit_iov_iter.o 69 - obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o 70 69 obj-$(CONFIG_TEST_IDA) += test_ida.o 71 70 obj-$(CONFIG_TEST_UBSAN) += test_ubsan.o 72 71 CFLAGS_test_ubsan.o += $(call cc-disable-warning, vla) 73 72 CFLAGS_test_ubsan.o += $(call cc-disable-warning, unused-but-set-variable) 74 73 UBSAN_SANITIZE_test_ubsan.o := y 75 74 obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o 76 - obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o 77 75 obj-$(CONFIG_TEST_MIN_HEAP) += test_min_heap.o 78 76 obj-$(CONFIG_TEST_LKM) += test_module.o 79 77 obj-$(CONFIG_TEST_VMALLOC) += test_vmalloc.o 80 78 obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o 81 - obj-$(CONFIG_TEST_SORT) += test_sort.o 82 79 obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o 83 80 obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o 84 81 obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o ··· 91 98 obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o 92 99 obj-$(CONFIG_TEST_PARMAN) += test_parman.o 93 100 obj-$(CONFIG_TEST_KMOD) += test_kmod.o 94 - obj-$(CONFIG_TEST_RUNTIME) += tests/ 95 101 obj-$(CONFIG_TEST_DEBUG_VIRTUAL) += test_debug_virtual.o 96 102 obj-$(CONFIG_TEST_MEMCAT_P) += test_memcat_p.o 97 103 obj-$(CONFIG_TEST_OBJAGG) += test_objagg.o ··· 99 107 obj-$(CONFIG_TEST_LOCKUP) += test_lockup.o 100 108 obj-$(CONFIG_TEST_HMM) += test_hmm.o 101 109 obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o 102 - obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o 103 110 obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o 104 - CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE) 105 - obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o 106 111 obj-$(CONFIG_TEST_OBJPOOL) += test_objpool.o 107 112 108 113 obj-$(CONFIG_TEST_FPU) += test_fpu.o ··· 121 132 obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o 122 133 CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) 123 134 124 - obj-y += math/ crypto/ 135 + obj-y += math/ crypto/ tests/ 125 136 126 137 obj-$(CONFIG_GENERIC_IOMAP) += iomap.o 127 138 obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o ··· 356 367 357 368 # pldmfw library 358 369 obj-$(CONFIG_PLDMFW) += pldmfw/ 359 - 360 - # KUnit tests 361 - CFLAGS_bitfield_kunit.o := $(DISABLE_STRUCTLEAK_PLUGIN) 362 - obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o 363 - obj-$(CONFIG_CHECKSUM_KUNIT) += checksum_kunit.o 364 - obj-$(CONFIG_UTIL_MACROS_KUNIT) += util_macros_kunit.o 365 - obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o 366 - obj-$(CONFIG_HASHTABLE_KUNIT_TEST) += hashtable_test.o 367 - obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o 368 - obj-$(CONFIG_BITS_TEST) += test_bits.o 369 - obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o 370 - obj-$(CONFIG_SLUB_KUNIT_TEST) += slub_kunit.o 371 - obj-$(CONFIG_MEMCPY_KUNIT_TEST) += memcpy_kunit.o 372 - obj-$(CONFIG_IS_SIGNED_TYPE_KUNIT_TEST) += is_signed_type_kunit.o 373 - CFLAGS_overflow_kunit.o = $(call cc-disable-warning, tautological-constant-out-of-range-compare) 374 - obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o 375 - CFLAGS_stackinit_kunit.o += $(call cc-disable-warning, switch-unreachable) 376 - obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o 377 - CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced) 378 - CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread) 379 - CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation) 380 - CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN) 381 - obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o 382 - obj-$(CONFIG_CRC_KUNIT_TEST) += crc_kunit.o 383 - obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o 384 - obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o 385 370 386 371 obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o 387 372
lib/bitfield_kunit.c lib/tests/bitfield_kunit.c
lib/checksum_kunit.c lib/tests/checksum_kunit.c
lib/cmdline_kunit.c lib/tests/cmdline_kunit.c
lib/cpumask_kunit.c lib/tests/cpumask_kunit.c
lib/crc_kunit.c lib/tests/crc_kunit.c
lib/fortify_kunit.c lib/tests/fortify_kunit.c
lib/hashtable_test.c lib/tests/hashtable_test.c
lib/is_signed_type_kunit.c lib/tests/is_signed_type_kunit.c
lib/kunit_iov_iter.c lib/tests/kunit_iov_iter.c
lib/list-test.c lib/tests/list-test.c
lib/memcpy_kunit.c lib/tests/memcpy_kunit.c
lib/overflow_kunit.c lib/tests/overflow_kunit.c
lib/siphash_kunit.c lib/tests/siphash_kunit.c
lib/slub_kunit.c lib/tests/slub_kunit.c
lib/stackinit_kunit.c lib/tests/stackinit_kunit.c
lib/string_helpers_kunit.c lib/tests/string_helpers_kunit.c
lib/string_kunit.c lib/tests/string_kunit.c
lib/test_bits.c lib/tests/test_bits.c
lib/test_fprobe.c lib/tests/test_fprobe.c
lib/test_hash.c lib/tests/test_hash.c
lib/test_kprobes.c lib/tests/test_kprobes.c
lib/test_linear_ranges.c lib/tests/test_linear_ranges.c
lib/test_list_sort.c lib/tests/test_list_sort.c
lib/test_sort.c lib/tests/test_sort.c
+40
lib/tests/Makefile
··· 1 + # SPDX-License-Identifier: GPL-2.0 2 + # 3 + # Makefile for tests of kernel library functions. 4 + 5 + # KUnit tests 6 + CFLAGS_bitfield_kunit.o := $(DISABLE_STRUCTLEAK_PLUGIN) 7 + obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o 8 + obj-$(CONFIG_BITS_TEST) += test_bits.o 9 + obj-$(CONFIG_CHECKSUM_KUNIT) += checksum_kunit.o 10 + obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o 11 + obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o 12 + obj-$(CONFIG_CRC_KUNIT_TEST) += crc_kunit.o 13 + CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced) 14 + CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread) 15 + CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation) 16 + CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN) 17 + obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o 18 + CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE) 19 + obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o 20 + obj-$(CONFIG_HASHTABLE_KUNIT_TEST) += hashtable_test.o 21 + obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o 22 + obj-$(CONFIG_TEST_IOV_ITER) += kunit_iov_iter.o 23 + obj-$(CONFIG_IS_SIGNED_TYPE_KUNIT_TEST) += is_signed_type_kunit.o 24 + obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o 25 + obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o 26 + obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o 27 + obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o 28 + obj-$(CONFIG_MEMCPY_KUNIT_TEST) += memcpy_kunit.o 29 + CFLAGS_overflow_kunit.o = $(call cc-disable-warning, tautological-constant-out-of-range-compare) 30 + obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o 31 + obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o 32 + obj-$(CONFIG_SLUB_KUNIT_TEST) += slub_kunit.o 33 + obj-$(CONFIG_TEST_SORT) += test_sort.o 34 + CFLAGS_stackinit_kunit.o += $(call cc-disable-warning, switch-unreachable) 35 + obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o 36 + obj-$(CONFIG_STRING_KUNIT_TEST) += string_kunit.o 37 + obj-$(CONFIG_STRING_HELPERS_KUNIT_TEST) += string_helpers_kunit.o 38 + obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o 39 + obj-$(CONFIG_UTIL_MACROS_KUNIT) += util_macros_kunit.o 40 + 1 41 obj-$(CONFIG_TEST_RUNTIME_MODULE) += module/
lib/usercopy_kunit.c lib/tests/usercopy_kunit.c
lib/util_macros_kunit.c lib/tests/util_macros_kunit.c