18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0+
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * xarray.c: Userspace shim for XArray test-suite
48c2ecf20Sopenharmony_ci * Copyright (c) 2018 Matthew Wilcox <willy@infradead.org>
58c2ecf20Sopenharmony_ci */
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#define XA_DEBUG
88c2ecf20Sopenharmony_ci#include "test.h"
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#define module_init(x)
118c2ecf20Sopenharmony_ci#define module_exit(x)
128c2ecf20Sopenharmony_ci#define MODULE_AUTHOR(x)
138c2ecf20Sopenharmony_ci#define MODULE_LICENSE(x)
148c2ecf20Sopenharmony_ci#define dump_stack()	assert(0)
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#include "../../../lib/xarray.c"
178c2ecf20Sopenharmony_ci#undef XA_DEBUG
188c2ecf20Sopenharmony_ci#include "../../../lib/test_xarray.c"
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_civoid xarray_tests(void)
218c2ecf20Sopenharmony_ci{
228c2ecf20Sopenharmony_ci	xarray_checks();
238c2ecf20Sopenharmony_ci	xarray_exit();
248c2ecf20Sopenharmony_ci}
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ciint __weak main(void)
278c2ecf20Sopenharmony_ci{
288c2ecf20Sopenharmony_ci	rcu_register_thread();
298c2ecf20Sopenharmony_ci	radix_tree_init();
308c2ecf20Sopenharmony_ci	xarray_tests();
318c2ecf20Sopenharmony_ci	radix_tree_cpu_dead(1);
328c2ecf20Sopenharmony_ci	rcu_barrier();
338c2ecf20Sopenharmony_ci	if (nr_allocated)
348c2ecf20Sopenharmony_ci		printf("nr_allocated = %d\n", nr_allocated);
358c2ecf20Sopenharmony_ci	rcu_unregister_thread();
368c2ecf20Sopenharmony_ci	return 0;
378c2ecf20Sopenharmony_ci}
38