xref: /linux/tools/testing/radix-tree/xarray.c (revision f879306834818ebd1722a4372079610cdd466fec)
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_DESCRIPTION(X)
14 #define MODULE_LICENSE(x)
15 #define dump_stack()	assert(0)
16 
17 #include "../../../lib/xarray.c"
18 #undef XA_DEBUG
19 #include "../../../lib/test_xarray.c"
20 
21 void xarray_tests(void)
22 {
23 	xarray_checks();
24 	xarray_exit();
25 }
26 
27 int __weak main(void)
28 {
29 	rcu_register_thread();
30 	radix_tree_init();
31 	xarray_tests();
32 	radix_tree_cpu_dead(1);
33 	rcu_barrier();
34 	if (nr_allocated)
35 		printf("nr_allocated = %d\n", nr_allocated);
36 	rcu_unregister_thread();
37 	return 0;
38 }
39