xref: /linux/tools/testing/radix-tree/xarray.c (revision d99ff463ecf651437e9e4abe68f331dfb6b5bd9d)
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * xarray.c: Userspace shim for XArray test-suite
4  * Copyright (c) 2018 Matthew Wilcox <willy@infradead.org>
5  */
6 
7 #define XA_DEBUG
8 #include "test.h"
9 
10 #define module_init(x)
11 #define module_exit(x)
12 #define MODULE_AUTHOR(x)
13 #define MODULE_LICENSE(x)
14 #define dump_stack()	assert(0)
15 
16 #include "../../../lib/xarray.c"
17 #undef XA_DEBUG
18 #include "../../../lib/test_xarray.c"
19 
20 void xarray_tests(void)
21 {
22 	xarray_checks();
23 	xarray_exit();
24 }
25 
26 int __weak main(void)
27 {
28 	rcu_register_thread();
29 	radix_tree_init();
30 	xarray_tests();
31 	radix_tree_cpu_dead(1);
32 	rcu_barrier();
33 	if (nr_allocated)
34 		printf("nr_allocated = %d\n", nr_allocated);
35 	rcu_unregister_thread();
36 	return 0;
37 }
38