forked from mirrors/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>
This commit is contained in:
		
							parent
							
								
									84ec093f55
								
							
						
					
					
						commit
						db6fe4d61e
					
				
					 29 changed files with 51 additions and 47 deletions
				
			
		
							
								
								
									
										19
									
								
								MAINTAINERS
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								MAINTAINERS
									
									
									
									
									
								
							|  | @ -4017,10 +4017,10 @@ F:	include/vdso/bits.h | ||||||
| F:	lib/bitmap-str.c | F:	lib/bitmap-str.c | ||||||
| F:	lib/bitmap.c | F:	lib/bitmap.c | ||||||
| F:	lib/cpumask.c | F:	lib/cpumask.c | ||||||
| F:	lib/cpumask_kunit.c |  | ||||||
| F:	lib/find_bit.c | F:	lib/find_bit.c | ||||||
| F:	lib/find_bit_benchmark.c | F:	lib/find_bit_benchmark.c | ||||||
| F:	lib/test_bitmap.c | F:	lib/test_bitmap.c | ||||||
|  | F:	lib/tests/cpumask_kunit.c | ||||||
| F:	tools/include/linux/bitfield.h | F:	tools/include/linux/bitfield.h | ||||||
| F:	tools/include/linux/bitmap.h | F:	tools/include/linux/bitmap.h | ||||||
| F:	tools/include/linux/bits.h | F:	tools/include/linux/bits.h | ||||||
|  | @ -9065,9 +9065,10 @@ L:	linux-hardening@vger.kernel.org | ||||||
| S:	Supported | S:	Supported | ||||||
| T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening | T:	git git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git for-next/hardening | ||||||
| F:	include/linux/fortify-string.h | F:	include/linux/fortify-string.h | ||||||
| F:	lib/fortify_kunit.c |  | ||||||
| F:	lib/memcpy_kunit.c |  | ||||||
| F:	lib/test_fortify/* | F:	lib/test_fortify/* | ||||||
|  | F:	lib/tests/fortify_kunit.c | ||||||
|  | F:	lib/tests/memcpy_kunit.c | ||||||
|  | F:	scripts/test_fortify.sh | ||||||
| K:	\bunsafe_memcpy\b | K:	\bunsafe_memcpy\b | ||||||
| K:	\b__NO_FORTIFY\b | K:	\b__NO_FORTIFY\b | ||||||
| 
 | 
 | ||||||
|  | @ -9755,9 +9756,9 @@ F:	include/linux/string.h | ||||||
| F:	include/linux/string_choices.h | F:	include/linux/string_choices.h | ||||||
| F:	include/linux/string_helpers.h | F:	include/linux/string_helpers.h | ||||||
| F:	lib/string.c | F:	lib/string.c | ||||||
| F:	lib/string_kunit.c |  | ||||||
| F:	lib/string_helpers.c | F:	lib/string_helpers.c | ||||||
| F:	lib/string_helpers_kunit.c | F:	lib/tests/string_helpers_kunit.c | ||||||
|  | F:	lib/tests/string_kunit.c | ||||||
| F:	scripts/coccinelle/api/string_choices.cocci | F:	scripts/coccinelle/api/string_choices.cocci | ||||||
| 
 | 
 | ||||||
| GENERIC UIO DRIVER FOR PCI DEVICES | GENERIC UIO DRIVER FOR PCI DEVICES | ||||||
|  | @ -12985,7 +12986,7 @@ F:	Documentation/trace/kprobes.rst | ||||||
| F:	include/asm-generic/kprobes.h | F:	include/asm-generic/kprobes.h | ||||||
| F:	include/linux/kprobes.h | F:	include/linux/kprobes.h | ||||||
| F:	kernel/kprobes.c | F:	kernel/kprobes.c | ||||||
| F:	lib/test_kprobes.c | F:	lib/tests/test_kprobes.c | ||||||
| F:	samples/kprobes | F:	samples/kprobes | ||||||
| 
 | 
 | ||||||
| KS0108 LCD CONTROLLER DRIVER | KS0108 LCD CONTROLLER DRIVER | ||||||
|  | @ -13315,7 +13316,7 @@ M:	Mark Brown <broonie@kernel.org> | ||||||
| R:	Matti Vaittinen <mazziesaccount@gmail.com> | R:	Matti Vaittinen <mazziesaccount@gmail.com> | ||||||
| F:	include/linux/linear_range.h | F:	include/linux/linear_range.h | ||||||
| F:	lib/linear_ranges.c | F:	lib/linear_ranges.c | ||||||
| F:	lib/test_linear_ranges.c | F:	lib/tests/test_linear_ranges.c | ||||||
| 
 | 
 | ||||||
| LINUX FOR POWER MACINTOSH | LINUX FOR POWER MACINTOSH | ||||||
| L:	linuxppc-dev@lists.ozlabs.org | L:	linuxppc-dev@lists.ozlabs.org | ||||||
|  | @ -13443,7 +13444,7 @@ M:	David Gow <davidgow@google.com> | ||||||
| L:	linux-kselftest@vger.kernel.org | L:	linux-kselftest@vger.kernel.org | ||||||
| L:	kunit-dev@googlegroups.com | L:	kunit-dev@googlegroups.com | ||||||
| S:	Maintained | S:	Maintained | ||||||
| F:	lib/list-test.c | F:	lib/tests/list-test.c | ||||||
| 
 | 
 | ||||||
| LITEX PLATFORM | LITEX PLATFORM | ||||||
| M:	Karol Gugala <kgugala@antmicro.com> | M:	Karol Gugala <kgugala@antmicro.com> | ||||||
|  | @ -21732,7 +21733,7 @@ M:	Jason A. Donenfeld <Jason@zx2c4.com> | ||||||
| S:	Maintained | S:	Maintained | ||||||
| F:	include/linux/siphash.h | F:	include/linux/siphash.h | ||||||
| F:	lib/siphash.c | F:	lib/siphash.c | ||||||
| F:	lib/siphash_kunit.c | F:	lib/tests/siphash_kunit.c | ||||||
| 
 | 
 | ||||||
| SIS 190 ETHERNET DRIVER | SIS 190 ETHERNET DRIVER | ||||||
| M:	Francois Romieu <romieu@fr.zoreil.com> | M:	Francois Romieu <romieu@fr.zoreil.com> | ||||||
|  |  | ||||||
							
								
								
									
										39
									
								
								lib/Makefile
									
									
									
									
									
								
							
							
						
						
									
										39
									
								
								lib/Makefile
									
									
									
									
									
								
							|  | @ -52,9 +52,7 @@ obj-y += bcd.o sort.o parser.o debug_locks.o random32.o \ | ||||||
| 	 percpu-refcount.o rhashtable.o base64.o \
 | 	 percpu-refcount.o rhashtable.o base64.o \
 | ||||||
| 	 once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \
 | 	 once.o refcount.o rcuref.o usercopy.o errseq.o bucket_locks.o \
 | ||||||
| 	 generic-radix-tree.o bitmap-str.o | 	 generic-radix-tree.o bitmap-str.o | ||||||
| obj-$(CONFIG_STRING_KUNIT_TEST) += string_kunit.o |  | ||||||
| obj-y += string_helpers.o | obj-y += string_helpers.o | ||||||
| obj-$(CONFIG_STRING_HELPERS_KUNIT_TEST) += string_helpers_kunit.o |  | ||||||
| obj-y += hexdump.o | obj-y += hexdump.o | ||||||
| obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o | obj-$(CONFIG_TEST_HEXDUMP) += test_hexdump.o | ||||||
| obj-y += kstrtox.o | obj-y += kstrtox.o | ||||||
|  | @ -65,22 +63,17 @@ obj-$(CONFIG_TEST_DHRY) += test_dhry.o | ||||||
| obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o | obj-$(CONFIG_TEST_FIRMWARE) += test_firmware.o | ||||||
| obj-$(CONFIG_TEST_BITOPS) += test_bitops.o | obj-$(CONFIG_TEST_BITOPS) += test_bitops.o | ||||||
| CFLAGS_test_bitops.o += -Werror | CFLAGS_test_bitops.o += -Werror | ||||||
| obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o |  | ||||||
| obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o | obj-$(CONFIG_TEST_SYSCTL) += test_sysctl.o | ||||||
| obj-$(CONFIG_TEST_IOV_ITER) += kunit_iov_iter.o |  | ||||||
| obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o |  | ||||||
| obj-$(CONFIG_TEST_IDA) += test_ida.o | obj-$(CONFIG_TEST_IDA) += test_ida.o | ||||||
| obj-$(CONFIG_TEST_UBSAN) += test_ubsan.o | obj-$(CONFIG_TEST_UBSAN) += test_ubsan.o | ||||||
| CFLAGS_test_ubsan.o += $(call cc-disable-warning, vla) | CFLAGS_test_ubsan.o += $(call cc-disable-warning, vla) | ||||||
| CFLAGS_test_ubsan.o += $(call cc-disable-warning, unused-but-set-variable) | CFLAGS_test_ubsan.o += $(call cc-disable-warning, unused-but-set-variable) | ||||||
| UBSAN_SANITIZE_test_ubsan.o := y | UBSAN_SANITIZE_test_ubsan.o := y | ||||||
| obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o | obj-$(CONFIG_TEST_KSTRTOX) += test-kstrtox.o | ||||||
| obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o |  | ||||||
| obj-$(CONFIG_TEST_MIN_HEAP) += test_min_heap.o | obj-$(CONFIG_TEST_MIN_HEAP) += test_min_heap.o | ||||||
| obj-$(CONFIG_TEST_LKM) += test_module.o | obj-$(CONFIG_TEST_LKM) += test_module.o | ||||||
| obj-$(CONFIG_TEST_VMALLOC) += test_vmalloc.o | obj-$(CONFIG_TEST_VMALLOC) += test_vmalloc.o | ||||||
| obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o | obj-$(CONFIG_TEST_RHASHTABLE) += test_rhashtable.o | ||||||
| obj-$(CONFIG_TEST_SORT) += test_sort.o |  | ||||||
| obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o | obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_keys.o | ||||||
| obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o | obj-$(CONFIG_TEST_STATIC_KEYS) += test_static_key_base.o | ||||||
| obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o | obj-$(CONFIG_TEST_DYNAMIC_DEBUG) += test_dynamic_debug.o | ||||||
|  | @ -98,7 +91,6 @@ obj-$(CONFIG_TEST_XARRAY) += test_xarray.o | ||||||
| obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o | obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o | ||||||
| obj-$(CONFIG_TEST_PARMAN) += test_parman.o | obj-$(CONFIG_TEST_PARMAN) += test_parman.o | ||||||
| obj-$(CONFIG_TEST_KMOD) += test_kmod.o | obj-$(CONFIG_TEST_KMOD) += test_kmod.o | ||||||
| obj-$(CONFIG_TEST_RUNTIME) += tests/ |  | ||||||
| obj-$(CONFIG_TEST_DEBUG_VIRTUAL) += test_debug_virtual.o | obj-$(CONFIG_TEST_DEBUG_VIRTUAL) += test_debug_virtual.o | ||||||
| obj-$(CONFIG_TEST_MEMCAT_P) += test_memcat_p.o | obj-$(CONFIG_TEST_MEMCAT_P) += test_memcat_p.o | ||||||
| obj-$(CONFIG_TEST_OBJAGG) += test_objagg.o | obj-$(CONFIG_TEST_OBJAGG) += test_objagg.o | ||||||
|  | @ -107,10 +99,7 @@ obj-$(CONFIG_TEST_MEMINIT) += test_meminit.o | ||||||
| obj-$(CONFIG_TEST_LOCKUP) += test_lockup.o | obj-$(CONFIG_TEST_LOCKUP) += test_lockup.o | ||||||
| obj-$(CONFIG_TEST_HMM) += test_hmm.o | obj-$(CONFIG_TEST_HMM) += test_hmm.o | ||||||
| obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o | obj-$(CONFIG_TEST_FREE_PAGES) += test_free_pages.o | ||||||
| obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o |  | ||||||
| obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o | obj-$(CONFIG_TEST_REF_TRACKER) += test_ref_tracker.o | ||||||
| CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE) |  | ||||||
| obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o |  | ||||||
| obj-$(CONFIG_TEST_OBJPOOL) += test_objpool.o | obj-$(CONFIG_TEST_OBJPOOL) += test_objpool.o | ||||||
| 
 | 
 | ||||||
| obj-$(CONFIG_TEST_FPU) += test_fpu.o | obj-$(CONFIG_TEST_FPU) += test_fpu.o | ||||||
|  | @ -132,7 +121,7 @@ endif | ||||||
| obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o | obj-$(CONFIG_DEBUG_INFO_REDUCED) += debug_info.o | ||||||
| CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) | CFLAGS_debug_info.o += $(call cc-option, -femit-struct-debug-detailed=any) | ||||||
| 
 | 
 | ||||||
| obj-y += math/ crypto/ | obj-y += math/ crypto/ tests/ | ||||||
| 
 | 
 | ||||||
| obj-$(CONFIG_GENERIC_IOMAP) += iomap.o | obj-$(CONFIG_GENERIC_IOMAP) += iomap.o | ||||||
| obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o | obj-$(CONFIG_HAS_IOMEM) += iomap_copy.o devres.o | ||||||
|  | @ -368,32 +357,6 @@ obj-$(CONFIG_OBJAGG) += objagg.o | ||||||
| # pldmfw library
 | # pldmfw library
 | ||||||
| obj-$(CONFIG_PLDMFW) += pldmfw/ | obj-$(CONFIG_PLDMFW) += pldmfw/ | ||||||
| 
 | 
 | ||||||
| # KUnit tests
 |  | ||||||
| CFLAGS_bitfield_kunit.o := $(DISABLE_STRUCTLEAK_PLUGIN) |  | ||||||
| obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o |  | ||||||
| obj-$(CONFIG_CHECKSUM_KUNIT) += checksum_kunit.o |  | ||||||
| obj-$(CONFIG_UTIL_MACROS_KUNIT) += util_macros_kunit.o |  | ||||||
| obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o |  | ||||||
| obj-$(CONFIG_HASHTABLE_KUNIT_TEST) += hashtable_test.o |  | ||||||
| obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o |  | ||||||
| obj-$(CONFIG_BITS_TEST) += test_bits.o |  | ||||||
| obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o |  | ||||||
| obj-$(CONFIG_SLUB_KUNIT_TEST) += slub_kunit.o |  | ||||||
| obj-$(CONFIG_MEMCPY_KUNIT_TEST) += memcpy_kunit.o |  | ||||||
| obj-$(CONFIG_IS_SIGNED_TYPE_KUNIT_TEST) += is_signed_type_kunit.o |  | ||||||
| CFLAGS_overflow_kunit.o = $(call cc-disable-warning, tautological-constant-out-of-range-compare) |  | ||||||
| obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o |  | ||||||
| CFLAGS_stackinit_kunit.o += $(call cc-disable-warning, switch-unreachable) |  | ||||||
| obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o |  | ||||||
| CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced) |  | ||||||
| CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread) |  | ||||||
| CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation) |  | ||||||
| CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN) |  | ||||||
| obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o |  | ||||||
| obj-$(CONFIG_CRC_KUNIT_TEST) += crc_kunit.o |  | ||||||
| obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o |  | ||||||
| obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o |  | ||||||
| 
 |  | ||||||
| obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o | obj-$(CONFIG_GENERIC_LIB_DEVMEM_IS_ALLOWED) += devmem_is_allowed.o | ||||||
| 
 | 
 | ||||||
| obj-$(CONFIG_FIRMWARE_TABLE) += fw_table.o | obj-$(CONFIG_FIRMWARE_TABLE) += fw_table.o | ||||||
|  |  | ||||||
|  | @ -1 +1,41 @@ | ||||||
|  | # SPDX-License-Identifier: GPL-2.0
 | ||||||
|  | #
 | ||||||
|  | # Makefile for tests of kernel library functions.
 | ||||||
|  | 
 | ||||||
|  | # KUnit tests
 | ||||||
|  | CFLAGS_bitfield_kunit.o := $(DISABLE_STRUCTLEAK_PLUGIN) | ||||||
|  | obj-$(CONFIG_BITFIELD_KUNIT) += bitfield_kunit.o | ||||||
|  | obj-$(CONFIG_BITS_TEST) += test_bits.o | ||||||
|  | obj-$(CONFIG_CHECKSUM_KUNIT) += checksum_kunit.o | ||||||
|  | obj-$(CONFIG_CMDLINE_KUNIT_TEST) += cmdline_kunit.o | ||||||
|  | obj-$(CONFIG_CPUMASK_KUNIT_TEST) += cpumask_kunit.o | ||||||
|  | obj-$(CONFIG_CRC_KUNIT_TEST) += crc_kunit.o | ||||||
|  | CFLAGS_fortify_kunit.o += $(call cc-disable-warning, unsequenced) | ||||||
|  | CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-overread) | ||||||
|  | CFLAGS_fortify_kunit.o += $(call cc-disable-warning, stringop-truncation) | ||||||
|  | CFLAGS_fortify_kunit.o += $(DISABLE_STRUCTLEAK_PLUGIN) | ||||||
|  | obj-$(CONFIG_FORTIFY_KUNIT_TEST) += fortify_kunit.o | ||||||
|  | CFLAGS_test_fprobe.o += $(CC_FLAGS_FTRACE) | ||||||
|  | obj-$(CONFIG_FPROBE_SANITY_TEST) += test_fprobe.o | ||||||
|  | obj-$(CONFIG_HASHTABLE_KUNIT_TEST) += hashtable_test.o | ||||||
|  | obj-$(CONFIG_HASH_KUNIT_TEST) += test_hash.o | ||||||
|  | obj-$(CONFIG_TEST_IOV_ITER) += kunit_iov_iter.o | ||||||
|  | obj-$(CONFIG_IS_SIGNED_TYPE_KUNIT_TEST) += is_signed_type_kunit.o | ||||||
|  | obj-$(CONFIG_KPROBES_SANITY_TEST) += test_kprobes.o | ||||||
|  | obj-$(CONFIG_LIST_KUNIT_TEST) += list-test.o | ||||||
|  | obj-$(CONFIG_TEST_LIST_SORT) += test_list_sort.o | ||||||
|  | obj-$(CONFIG_LINEAR_RANGES_TEST) += test_linear_ranges.o | ||||||
|  | obj-$(CONFIG_MEMCPY_KUNIT_TEST) += memcpy_kunit.o | ||||||
|  | CFLAGS_overflow_kunit.o = $(call cc-disable-warning, tautological-constant-out-of-range-compare) | ||||||
|  | obj-$(CONFIG_OVERFLOW_KUNIT_TEST) += overflow_kunit.o | ||||||
|  | obj-$(CONFIG_SIPHASH_KUNIT_TEST) += siphash_kunit.o | ||||||
|  | obj-$(CONFIG_SLUB_KUNIT_TEST) += slub_kunit.o | ||||||
|  | obj-$(CONFIG_TEST_SORT) += test_sort.o | ||||||
|  | CFLAGS_stackinit_kunit.o += $(call cc-disable-warning, switch-unreachable) | ||||||
|  | obj-$(CONFIG_STACKINIT_KUNIT_TEST) += stackinit_kunit.o | ||||||
|  | obj-$(CONFIG_STRING_KUNIT_TEST) += string_kunit.o | ||||||
|  | obj-$(CONFIG_STRING_HELPERS_KUNIT_TEST) += string_helpers_kunit.o | ||||||
|  | obj-$(CONFIG_USERCOPY_KUNIT_TEST) += usercopy_kunit.o | ||||||
|  | obj-$(CONFIG_UTIL_MACROS_KUNIT) += util_macros_kunit.o | ||||||
|  | 
 | ||||||
| obj-$(CONFIG_TEST_RUNTIME_MODULE)		+= module/ | obj-$(CONFIG_TEST_RUNTIME_MODULE)		+= module/ | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Kees Cook
						Kees Cook