]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
maple_tree: Make test code work without debug enabled
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Thu, 1 Dec 2022 16:48:12 +0000 (11:48 -0500)
committerLiam R. Howlett <Liam.Howlett@oracle.com>
Mon, 13 Feb 2023 13:42:04 +0000 (08:42 -0500)
The test code is less useful without debug, but can still do general
validations.  Define mt_dump(), mas_dump() and mas_wr_dump() as a noop
if debug is not enabled and document it in the test module information
that more information can be obtained with another kernel config option.

Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
lib/Kconfig.debug
lib/test_maple_tree.c
tools/testing/radix-tree/maple.c

index 958087475edbbce84d98c668550429af441acf38..db98e1fd0c602a16b368be621fa3521044ce59a7 100644 (file)
@@ -2213,9 +2213,13 @@ config TEST_XARRAY
        tristate "Test the XArray code at runtime"
 
 config TEST_MAPLE_TREE
-       depends on DEBUG_KERNEL
-       select DEBUG_MAPLE_TREE
-       tristate "Test the Maple Tree code at runtime"
+       tristate "Test the Maple Tree code at runtime or module load"
+       help
+         Enable this option to test the maple tree code functions at boot, or
+         when the module is loaded. Enable "Debug Maple Trees" will enable
+         more verbose output on failures.
+
+         If unsure, say N.
 
 config TEST_RHASHTABLE
        tristate "Perform selftest on resizable hash table"
index dbb150e106d5ba708670bcb2d087871e21ae7e04..a2f0b3f0a80775c75030025983daa12cf5fb43b8 100644 (file)
 #include <linux/module.h>
 
 #define MTREE_ALLOC_MAX 0x2000000000000Ul
-#ifndef CONFIG_DEBUG_MAPLE_TREE
-#define CONFIG_DEBUG_MAPLE_TREE
-#endif
 #define CONFIG_MAPLE_SEARCH
 #define MAPLE_32BIT (MAPLE_NODE_SLOTS > 31)
 
+#ifndef CONFIG_DEBUG_MAPLE_TREE
+#define mt_dump(mt, fmt)               do {} while (0)
+#define mas_dump(mas)                  do {} while (0)
+#define mas_wr_dump(mas)               do {} while (0)
+#endif
+
 /* #define BENCH_SLOT_STORE */
 /* #define BENCH_NODE_STORE */
 /* #define BENCH_AWALK */
index a53cb12c02ef93159b123dcb3516e951d0f20d6f..a65a74ec08406fb9c6f70ef51a37e663db19a1db 100644 (file)
@@ -22,7 +22,6 @@
 #define dump_stack()   assert(0)
 
 #include "../../../lib/maple_tree.c"
-#undef CONFIG_DEBUG_MAPLE_TREE
 #include "../../../lib/test_maple_tree.c"
 
 #define RCU_RANGE_COUNT 1000