Hi Daniek On Mon, 7 Feb 2022 at 21:29, Daniel Latypov <dlatypov@xxxxxxxxxx> wrote: > > On Mon, Feb 7, 2022 at 11:09 AM Daniel Latypov <dlatypov@xxxxxxxxxx> wrote: > > > > On Mon, Feb 7, 2022 at 10:33 AM Ricardo Ribalda <ribalda@xxxxxxxxxxxx> wrote: > > > > > > Today, when we want to check if a pointer is NULL and not ERR we have > > > two options: > > > > > > EXPECT_TRUE(test, ptr == NULL); > > > > > > or > > > > > > EXPECT_PTR_NE(test, ptr, (struct mystruct *)NULL); > > > > > > Create a new set of macros that take care of NULL checks. > > > > I think we've usually had people do > > KUNIT_EXPECT_FALSE(test, nullptr); > > > > I'm not personally against having an explicit NULL check, however. > > > > But if we want to continue with this, we'll want to rebase on top of > > https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/?h=kunit > > since a lot of this code has been deleted or refactored. > > E.g. see https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/tree/include/kunit/test.h?h=kunit > > I forgot to mention, it'd also be a good idea to update the new > example test case: > https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/tree/lib/kunit/kunit-example-test.c?h=kunit#n76 Already in v2 Thanks for your flash review :) > > e.g. just adding > KUNIT_EXPECT_NULL(test, NULL); > with the rest of the pointer assertions -- Ricardo Ribalda