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