Re: Converting kselftest test modules to kunit

Muhammad Usama Anjum
2024-07-17T10:47:49Z

Hi David,

On 7/16/24 12:33 PM, David Gow wrote:
> On Mon, 15 Jul 2024 at 18:09, Muhammad Usama Anjum
> <usama.anjum@collabora.com> wrote:
>>
>> Hi Kees and All,
>>
>> There are several tests in kselftest subsystem which load modules to tests
>> the internals of the kernel. Most of these test modules are just loaded by
>> the kselftest, their status isn't read and reported to the user logs. Hence
>> they don't provide benefit of executing those tests.
>>
>> I've found patches from Kees where he has been converting such kselftests
>> to kunit tests [1]. The probable motivation is to move tests output of
>> kselftest subsystem which only triggers tests without correctly reporting
>> the results. On the other hand, kunit is there to test the kernel's
>> internal functions which can't be done by userspace.
>>
>> Kselftest: Test user facing APIs from userspace
>> Kunit: Test kernel's internal functions from kernelspace
>
> Yes: this is how we'd like to split things up. There are still a few
> cases where you might want to use kselftest to test something other
> than a user-facing API (if you needed to set up some complicated
> userspace structures, etc), or cases where KUnit might be used to test
> something other than individual pieces of functionality, but that
> categorisation is a good start.
Yeah, makes sense. It is helpful to find out what others think. I'll be
back with changes.

>
> The Documentation/dev-tools/testing-overview.rst page has a more
> detailed look at when to use which test framework (which basically
> just repeats those rules):
> https://docs.kernel.org/dev-tools/testing-overview.html
>
> Cheers,
> -- David

--
BR,
Muhammad Usama Anjum