[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZANfOj1MN+HHaF9n@yilunxu-OptiPlex-7050>
Date: Sat, 4 Mar 2023 23:09:46 +0800
From: Xu Yilun <yilun.xu@...el.com>
To: Marco Pagani <marpagan@...hat.com>
Cc: Moritz Fischer <mdf@...nel.org>, Wu Hao <hao.wu@...el.com>,
Tom Rix <trix@...hat.com>, linux-kernel@...r.kernel.org,
linux-fpga@...r.kernel.org
Subject: Re: [RFC PATCH 1/4] fpga: add initial KUnit test suite
> >>>> + ret = init_sgt_bit(&sgt_bit, fake_bit, FAKE_BIT_SIZE);
> >>>> + KUNIT_ASSERT_EQ(test, ret, 0);
> >>>
> >>> This is not fpga function, do we need the ASSERT?
> >>>
> >>
> >> You're right. I'll change it to EXPECT.
> >
> > Mm.. I think we may move the sgt initialization in .suite_init, and just
> > return ERROR for failure. Does it help to quickly find out this is an
> > ENV error, not a test case failure?
>
> I looked through the documentation for guidelines on how to handle
> initialization errors, but found only the eeprom example where KUNIT_ASSERT
> is used to handle errors in eeprom_buffer_test_init(). Existing test suites
> seem to use different approaches to handle initialization errors. Some
> return an error code, while others use KUnit assertions.
>
> I'm more inclined to follow the example in the documentation and use
> KUnit assertions. Does this approach work for you?
It's good to me.
>
>
> After some thought, I'm restructuring the code to test single components
> in isolation before testing them together. In this way, I think the test
> suite will be more in line with the unit testing methodology.
>
>
> Thanks,
> Marco
>
Powered by blists - more mailing lists