Path: blob/master/tools/testing/rbtree/interval_tree_test.c
26282 views
// SPDX-License-Identifier: GPL-2.01/*2* interval_tree.c: Userspace Interval Tree test-suite3* Copyright (c) 2025 Wei Yang <[email protected]>4*/5#include <linux/math64.h>6#include <linux/kern_levels.h>7#include "shared.h"8#include "maple-shared.h"910#include "../../../lib/interval_tree_test.c"1112int usage(void)13{14fprintf(stderr, "Userland interval tree test cases\n");15fprintf(stderr, " -n: Number of nodes in the interval tree\n");16fprintf(stderr, " -p: Number of iterations modifying the tree\n");17fprintf(stderr, " -q: Number of searches to the interval tree\n");18fprintf(stderr, " -s: Number of iterations searching the tree\n");19fprintf(stderr, " -a: Searches will iterate all nodes in the tree\n");20fprintf(stderr, " -m: Largest value for the interval's endpoint\n");21fprintf(stderr, " -r: Random seed\n");22exit(-1);23}2425void interval_tree_tests(void)26{27interval_tree_test_init();28interval_tree_test_exit();29}3031int main(int argc, char **argv)32{33int opt;3435while ((opt = getopt(argc, argv, "n:p:q:s:am:r:")) != -1) {36if (opt == 'n')37nnodes = strtoul(optarg, NULL, 0);38else if (opt == 'p')39perf_loops = strtoul(optarg, NULL, 0);40else if (opt == 'q')41nsearches = strtoul(optarg, NULL, 0);42else if (opt == 's')43search_loops = strtoul(optarg, NULL, 0);44else if (opt == 'a')45search_all = true;46else if (opt == 'm')47max_endpoint = strtoul(optarg, NULL, 0);48else if (opt == 'r')49seed = strtoul(optarg, NULL, 0);50else51usage();52}5354maple_tree_init();55interval_tree_tests();56return 0;57}585960