On Tue, Jun 25, 2024 at 10:17:58PM +0100, Matthew Wilcox (Oracle) wrote: > This is not a very sophisticated test suite yet, but it helped find > a few bugs and provides a framework for adding more tests as more > bugs are found. > > Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx> > --- > lib/Kconfig.debug | 3 + > lib/Makefile | 1 + > lib/test_rosebush.c | 140 ++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 144 insertions(+) > create mode 100644 lib/test_rosebush.c > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug > index 59b6765d86b8..f3cfd79d8dbd 100644 > --- a/lib/Kconfig.debug > +++ b/lib/Kconfig.debug > @@ -2447,6 +2447,9 @@ config TEST_RHASHTABLE > > If unsure, say N. > > +config TEST_ROSEBUSH > + tristate "Test the Rosebush data structure" > + This needs a `depends on KUNIT`. And compiling this test as module results in rbh_destroy not found. I think you missed EXPORT_SYMBOL of rbh_destroy in the previous patch. > config TEST_IDA > tristate "Perform selftest on IDA functions" > > + > +static void check_empty_rbh(struct kunit *test, struct rbh *rbh) > +{ > + iter_rbh(test, rbh, 0, NULL); > + iter_rbh(test, rbh, 1, NULL); > + iter_rbh(test, rbh, 17, NULL); > + iter_rbh(test, rbh, 42, NULL); > +} Do these hashes hold any significance that you test them often after an insert? -- Pankaj