--- /dev/null
+#include "../../../include/linux/rosebush.h"
xarray
maple
ma_xa_benchmark
+rosebush
-D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined
LDFLAGS += -fsanitize=address -fsanitize=undefined
LDLIBS+= -lpthread -lurcu
-TARGETS = main idr-test multiorder xarray maple
+TARGETS = main idr-test multiorder xarray maple rosebush
CORE_OFILES := xarray.o radix-tree.o idr.o linux.o test.o find_bit.o bitmap.o \
slab.o maple.o
OFILES = main.o $(CORE_OFILES) regression1.o regression2.o regression3.o \
maple: $(CORE_OFILES)
+rosebush: $(CORE_OFILES)
+
multiorder: multiorder.o $(CORE_OFILES)
clean:
maple.o: ../../../lib/maple_tree.c ../../../lib/test_maple_tree.c
+rosebush.o: ../../../lib/rosebush.c ../../../lib/test_rosebush.c
+
generated/map-shift.h:
@if ! grep -qws $(SHIFT) generated/map-shift.h; then \
echo "#define XA_CHUNK_SHIFT $(SHIFT)" > \
--- /dev/null
+struct kunit {
+};
+
+struct kunit_case {
+ void (*run_case)(struct kunit *test);
+};
+
+struct kunit_suite {
+ char *name;
+ struct kunit_case *test_cases;
+};
+
+#define KUNIT_CASE(test_name) { .run_case = test_name, }
+#define kunit_test_suite(x)
+
+#define KUNIT_EXPECT_EQ(test, left, right) \
+ KUNIT_EXPECT_PTR_EQ_MSG(test, left, right, NULL)
+#define KUNIT_EXPECT_PTR_EQ_MSG(test, left, right, fmt, ...) \
+ assert(left == right)
+
--- /dev/null
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * rosebush.c: Userspace testing for rosebush test-suite
+ * Copyright (c) 2024 Oracle Corporation
+ * Author: Matthew Wilcox <willy@infradead.org>
+ */
+
+#include "test.h"
+#include <stdlib.h>
+#include <time.h>
+
+#define module_init(x)
+#define module_exit(x)
+#define MODULE_AUTHOR(x)
+#define MODULE_LICENSE(x)
+#define dump_stack() assert(0)
+
+#include "../../../lib/rosebush.c"
+#include "../../../lib/test_rosebush.c"
+
+int __weak main(void)
+{
+ struct kunit test;
+ int i;
+
+ assert(rosebush_suite.test_cases == rosebush_cases);
+
+ for (i = 0; i < ARRAY_SIZE(rosebush_cases); i++) {
+ if (!rosebush_cases[i].run_case)
+ continue;
+ printf("i = %d %p\n", i, rosebush_cases[i].run_case);
+ rosebush_cases[i].run_case(&test);
+ }
+
+ return 0;
+}