Re: [PATCH 2/3] list: test: Add a test for list_is_head()

From: Andy Shevchenko
Date: Sat Feb 05 2022 - 08:09:49 EST


On Sat, Feb 05, 2022 at 02:15:37PM +0800, David Gow wrote:
> list_is_head() was added recently[1], and didn't have a KUnit test. The
> implementation is trivial, so it's not a particularly exciting test, but
> it'd be nice to get back to full coverage of the list functions.
>
> [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/include/linux/list.h?id=0425473037db40d9e322631f2d4dc6ef51f97e88

...

> +static void list_test_list_is_head(struct kunit *test)
> +{
> + struct list_head a, b;
> +
> + KUNIT_EXPECT_TRUE(test, list_is_head(&a, &a));

OK.

> + KUNIT_EXPECT_FALSE(test, list_is_head(&a, &b));

Perhaps OK, but the main case here is to test an (arbitrary) member of the existing list.

> +}

--
With Best Regards,
Andy Shevchenko