diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-09-09 01:52:17 -0400 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-10-21 10:46:46 -0400 |
commit | 4f06d6302da682157890f72c0573e12a73536814 (patch) | |
tree | ad61fcd160cb757cf34f173f596c927885742af3 /tools/testing | |
parent | 93eb07f72c8d86f8fe5e90907df1cc037f6ffbb7 (diff) |
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')
-rw-r--r-- | tools/testing/radix-tree/multiorder.c | 48 |
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 @@ | |||
20 | 20 | ||
21 | #include "test.h" | 21 | #include "test.h" |
22 | 22 | ||
23 | static void multiorder_check(unsigned long index, int order) | ||
24 | { | ||
25 | unsigned long i; | ||
26 | unsigned long min = index & ~((1UL << order) - 1); | ||
27 | unsigned long max = min + (1UL << order); | ||
28 | void **slot; | ||
29 | struct item *item2 = item_create(min, order); | ||
30 | RADIX_TREE(tree, GFP_KERNEL); | ||
31 | |||
32 | printv(2, "Multiorder index %ld, order %d\n", index, order); | ||
33 | |||
34 | assert(item_insert_order(&tree, index, order) == 0); | ||
35 | |||
36 | for (i = min; i < max; i++) { | ||
37 | struct item *item = item_lookup(&tree, i); | ||
38 | assert(item != 0); | ||
39 | assert(item->index == index); | ||
40 | } | ||
41 | for (i = 0; i < min; i++) | ||
42 | item_check_absent(&tree, i); | ||
43 | for (i = max; i < 2*max; i++) | ||
44 | item_check_absent(&tree, i); | ||
45 | for (i = min; i < max; i++) | ||
46 | assert(radix_tree_insert(&tree, i, item2) == -EEXIST); | ||
47 | |||
48 | slot = radix_tree_lookup_slot(&tree, index); | ||
49 | free(*slot); | ||
50 | radix_tree_replace_slot(&tree, slot, item2); | ||
51 | for (i = min; i < max; i++) { | ||
52 | struct item *item = item_lookup(&tree, i); | ||
53 | assert(item != 0); | ||
54 | assert(item->index == min); | ||
55 | } | ||
56 | |||
57 | assert(item_delete(&tree, min) != 0); | ||
58 | |||
59 | for (i = 0; i < 2*max; i++) | ||
60 | item_check_absent(&tree, i); | ||
61 | } | ||
62 | |||
63 | void multiorder_iteration(void) | 23 | void multiorder_iteration(void) |
64 | { | 24 | { |
65 | RADIX_TREE(tree, GFP_KERNEL); | 25 | RADIX_TREE(tree, GFP_KERNEL); |
@@ -251,14 +211,6 @@ static void multiorder_iteration_race(void) | |||
251 | 211 | ||
252 | void multiorder_checks(void) | 212 | void multiorder_checks(void) |
253 | { | 213 | { |
254 | int i; | ||
255 | |||
256 | for (i = 0; i < 20; i++) { | ||
257 | multiorder_check(200, i); | ||
258 | multiorder_check(0, i); | ||
259 | multiorder_check((1UL << i) + 1, i); | ||
260 | } | ||
261 | |||
262 | multiorder_iteration(); | 214 | multiorder_iteration(); |
263 | multiorder_tagged_iteration(); | 215 | multiorder_tagged_iteration(); |
264 | multiorder_iteration_race(); | 216 | multiorder_iteration_race(); |