[Linux-kernel-mentees] [PATCH] kunit: Customize KUNIT_EXCEPT/KUNIT_ASSERT Expected messages

Vitor Massaru Iha vitor at massaru.org
Thu Aug 20 20:02:19 UTC 2020


On Wed, Aug 19, 2020 at 7:24 PM Brendan Higgins
<brendanhiggins at google.com> wrote:
>
> On Wed, Aug 19, 2020 at 12:39 PM Vitor Massaru Iha <vitor at massaru.org> wrote:
> >
> > In some cases, to maintain the consistency of the Expected messages
> > with the original runtime test, it is necessary to customize the
> > Expected messages on KUnit.
> >
> > As an example test_overflow conversion to KUnit (I added 1,
> > p->s_of+1, just to fail the test).
> >
> > Using KUNIT_EXPECT_EQ:
> >
> > Expected _of == p->s_of+1, but
> >   _of == 0
> >   p->s_of+1 == 1
> > not ok 1 - overflow_calculation_test
> > ok 2 - overflow_shift_test
> >
> > Using KUNIT_EXPECT_EQ_CUSTOM_MSG:
> >
> > Expected 0 + 0 to not overflow (type u8)
> > not ok 1 - overflow_calculation_test
> >
> > Which is more similar to the error message of the original test.
> >
> > Signed-off-by: Vitor Massaru Iha <vitor at massaru.org>
>
> All in all this looks pretty reasonable to me; however, is there any
> chance you could provide an example of its usage?

Sure I'll do that.

I am reviewing the errors reported by 0day in the overflow_kunit patch v3,
and I noticed when compiling overflow_kunit with the parameters of
0day and this patch, there were some errors related to this patch that I sent.

I'll fix it too.


More information about the Linux-kernel-mentees mailing list