From: Matthew Wilcox (Oracle) Date: Sun, 13 Oct 2019 03:24:44 +0000 (-0400) Subject: maple_tree: New check_find2 test X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=7cd31466de0c24e67039d4b5a86cddf199d30bc1;p=users%2Fjedix%2Flinux-maple.git maple_tree: New check_find2 test This is supposed to test various different conditions, but it currently falls over trying to iterate a tree with no entries in it. Signed-off-by: Matthew Wilcox (Oracle) --- diff --git a/lib/test_maple_tree.c b/lib/test_maple_tree.c index 429159847fba..c94aab1ae861 100644 --- a/lib/test_maple_tree.c +++ b/lib/test_maple_tree.c @@ -465,6 +465,28 @@ static noinline void check_find(struct maple_tree *mt) mtree_destroy(mt); } +static noinline void check_find_2(struct maple_tree *mt) +{ + unsigned long i, j; + void *entry; + MA_STATE(mas, mt, 0, 0); + + mas_for_each(&mas, entry, ULONG_MAX) + MT_BUG_ON(mt, true); + + for (i = 0; i < 256; i++) { + mtree_insert_index(mt, i, GFP_KERNEL); + j = 0; + mas_set(&mas, 0); + mas_for_each(&mas, entry, ULONG_MAX) { + MT_BUG_ON(mt, entry != xa_mk_value(j)); + j++; + } + MT_BUG_ON(mt, j != i + 1); + } + + mtree_destroy(mt); +} #define erase_ptr(i) entry[i%2] #define erase_check_load(mt, i) check_load(mt, set[i], entry[i%2]) @@ -1158,6 +1180,7 @@ static int maple_tree_seed(void) check_mid_split(&tree); check_find(&tree); + check_find_2(&tree); rcu_barrier();