summaryrefslogtreecommitdiff
path: root/tools/testing/radix-tree
diff options
context:
space:
mode:
authorMatthew Wilcox <willy@infradead.org>2018-09-09 08:52:17 +0300
committerMatthew Wilcox <willy@infradead.org>2018-10-21 17:46:46 +0300
commit4f06d6302da682157890f72c0573e12a73536814 (patch)
treead61fcd160cb757cf34f173f596c927885742af3 /tools/testing/radix-tree
parent93eb07f72c8d86f8fe5e90907df1cc037f6ffbb7 (diff)
downloadlinux-4f06d6302da682157890f72c0573e12a73536814.tar.xz
xarray: Move multiorder_check to in-kernel tests
This version is a little less thorough in order to be a little quicker, but tests the important edge cases. Also test adding a multiorder entry at a non-canonical index, and erasing it. Signed-off-by: Matthew Wilcox <willy@infradead.org>
Diffstat (limited to 'tools/testing/radix-tree')
-rw-r--r--tools/testing/radix-tree/multiorder.c48
1 files changed, 0 insertions, 48 deletions
diff --git a/tools/testing/radix-tree/multiorder.c b/tools/testing/radix-tree/multiorder.c
index a60c03287e9c..6e8d66c2aa89 100644
--- a/tools/testing/radix-tree/multiorder.c
+++ b/tools/testing/radix-tree/multiorder.c
@@ -20,46 +20,6 @@
#include "test.h"
-static void multiorder_check(unsigned long index, int order)
-{
- unsigned long i;
- unsigned long min = index & ~((1UL << order) - 1);
- unsigned long max = min + (1UL << order);
- void **slot;
- struct item *item2 = item_create(min, order);
- RADIX_TREE(tree, GFP_KERNEL);
-
- printv(2, "Multiorder index %ld, order %d\n", index, order);
-
- assert(item_insert_order(&tree, index, order) == 0);
-
- for (i = min; i < max; i++) {
- struct item *item = item_lookup(&tree, i);
- assert(item != 0);
- assert(item->index == index);
- }
- for (i = 0; i < min; i++)
- item_check_absent(&tree, i);
- for (i = max; i < 2*max; i++)
- item_check_absent(&tree, i);
- for (i = min; i < max; i++)
- assert(radix_tree_insert(&tree, i, item2) == -EEXIST);
-
- slot = radix_tree_lookup_slot(&tree, index);
- free(*slot);
- radix_tree_replace_slot(&tree, slot, item2);
- for (i = min; i < max; i++) {
- struct item *item = item_lookup(&tree, i);
- assert(item != 0);
- assert(item->index == min);
- }
-
- assert(item_delete(&tree, min) != 0);
-
- for (i = 0; i < 2*max; i++)
- item_check_absent(&tree, i);
-}
-
void multiorder_iteration(void)
{
RADIX_TREE(tree, GFP_KERNEL);
@@ -251,14 +211,6 @@ static void multiorder_iteration_race(void)
void multiorder_checks(void)
{
- int i;
-
- for (i = 0; i < 20; i++) {
- multiorder_check(200, i);
- multiorder_check(0, i);
- multiorder_check((1UL << i) + 1, i);
- }
-
multiorder_iteration();
multiorder_tagged_iteration();
multiorder_iteration_race();