1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * rbtree_test.c: Userspace Red Black Tree test-suite 4 * Copyright (c) 2025 Wei Yang <richard.weiyang@gmail.com> 5 */ 6 #include <linux/init.h> 7 #include <linux/math64.h> 8 #include <linux/kern_levels.h> 9 #include "shared.h" 10 11 #include "../../../lib/rbtree_test.c" 12 13 int usage(void) 14 { 15 fprintf(stderr, "Userland rbtree test cases\n"); 16 fprintf(stderr, " -n: Number of nodes in the rb-tree\n"); 17 fprintf(stderr, " -p: Number of iterations modifying the rb-tree\n"); 18 fprintf(stderr, " -c: Number of iterations modifying and verifying the rb-tree\n"); 19 fprintf(stderr, " -r: Random seed\n"); 20 exit(-1); 21 } 22 23 void rbtree_tests(void) 24 { 25 rbtree_test_init(); 26 rbtree_test_exit(); 27 } 28 29 int main(int argc, char **argv) 30 { 31 int opt; 32 33 while ((opt = getopt(argc, argv, "n:p:c:r:")) != -1) { 34 if (opt == 'n') 35 nnodes = strtoul(optarg, NULL, 0); 36 else if (opt == 'p') 37 perf_loops = strtoul(optarg, NULL, 0); 38 else if (opt == 'c') 39 check_loops = strtoul(optarg, NULL, 0); 40 else if (opt == 'r') 41 seed = strtoul(optarg, NULL, 0); 42 else 43 usage(); 44 } 45 46 rbtree_tests(); 47 return 0; 48 } 49