mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-10-29 13:23:23 +01:00
xarray: port tests to kunit
Minimally rewrite the XArray unit tests to use kunit. This integrates nicely with existing kunit tools which produce nicer human-readable output compared to the existing machinery. Running the xarray tests before this change requires an obscure invocation ``` tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 \ --kconfig_add CONFIG_TEST_XARRAY=y --raw_output=all nothing ``` which on failure produces ``` BUG at check_reserve:513 ... XArray: 6782340 of 6782364 tests passed ``` and exits 0. Running the xarray tests after this change requires a simpler invocation ``` tools/testing/kunit/kunit.py run --arch arm64 --make_options LLVM=1 \ xarray ``` which on failure produces (colors omitted) ``` [09:50:53] ====================== check_reserve ====================== [09:50:53] [FAILED] param-0 [09:50:53] # check_reserve: EXPECTATION FAILED at lib/test_xarray.c:536 [09:50:53] xa_erase(xa, 12345678) != NULL ... [09:50:53] # module: test_xarray [09:50:53] # xarray: pass:26 fail:3 skip:0 total:29 [09:50:53] # Totals: pass:28 fail:3 skip:0 total:31 [09:50:53] ===================== [FAILED] xarray ====================== ``` and exits 1. Use of richer kunit assertions is intentionally omitted to reduce the scope of the change. [[email protected]: fix cocci warning] Link: https://lore.kernel.org/oe-kbuild-all/[email protected]/ Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Tamir Duberstein <[email protected]> Cc: Bill Wendling <[email protected]> Cc: Christophe Leroy <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Justin Stitt <[email protected]> Cc: Madhavan Srinivasan <[email protected]> Cc: Michael Ellerman <[email protected]> Cc: Nathan Chancellor <[email protected]> Cc: Naveen N Rao <[email protected]> Cc: Nicholas Piggin <[email protected]> Cc: Nick Desaulniers <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
This commit is contained in:
1 parent
7a77edf45a
commit
c7bb5cf9fc
16 files changed
+403
-287
No files matched your search
@@ -629,7 +629,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -586,7 +586,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -606,7 +606,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -578,7 +578,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -588,7 +588,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -605,7 +605,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -692,7 +692,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -578,7 +578,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -579,7 +579,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -595,7 +595,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -575,7 +575,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -576,7 +576,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
@@ -451,7 +451,6 @@ CONFIG_TEST_PRINTF=m
|
||||
CONFIG_TEST_SCANF=m
|
||||
CONFIG_TEST_BITMAP=m
|
||||
CONFIG_TEST_UUID=m
|
||||
CONFIG_TEST_XARRAY=m
|
||||
CONFIG_TEST_MAPLE_TREE=m
|
||||
CONFIG_TEST_RHASHTABLE=m
|
||||
CONFIG_TEST_IDA=m
|
||||
|
||||
+16
-2
@@ -2456,8 +2456,22 @@ config TEST_BITMAP
|
||||
config TEST_UUID
|
||||
tristate "Test functions located in the uuid module at runtime"
|
||||
|
||||
config TEST_XARRAY
|
||||
tristate "Test the XArray code at runtime"
|
||||
config XARRAY_KUNIT
|
||||
tristate "KUnit test XArray code at runtime" if !KUNIT_ALL_TESTS
|
||||
depends on KUNIT
|
||||
default KUNIT_ALL_TESTS
|
||||
help
|
||||
Enable this option to test the Xarray code at boot.
|
||||
|
||||
KUnit tests run during boot and output the results to the debug log
|
||||
in TAP format (http://testanything.org/). Only useful for kernel devs
|
||||
running the KUnit test harness, and not intended for inclusion into a
|
||||
production build.
|
||||
|
||||
For more information on KUnit and unit tests in general please refer
|
||||
to the KUnit documentation in Documentation/dev-tools/kunit/.
|
||||
|
||||
If unsure, say N.
|
||||
|
||||
config TEST_MAPLE_TREE
|
||||
tristate "Test the Maple Tree code at runtime or module load"
|
||||
|
||||
+1
-1
@@ -94,7 +94,6 @@ GCOV_PROFILE_test_bitmap.o := n
|
||||
endif
|
||||
|
||||
obj-$(CONFIG_TEST_UUID) += test_uuid.o
|
||||
obj-$(CONFIG_TEST_XARRAY) += test_xarray.o
|
||||
obj-$(CONFIG_TEST_MAPLE_TREE) += test_maple_tree.o
|
||||
obj-$(CONFIG_TEST_PARMAN) += test_parman.o
|
||||
obj-$(CONFIG_TEST_KMOD) += test_kmod.o
|
||||
@@ -375,6 +374,7 @@ 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_XARRAY_KUNIT) += test_xarray.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
|
||||
|
||||
+386
-271
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user