[Linux-kernel-mentees] [PATCH v2] lib: kunit: add list_sort test conversion to KUnit

Andy Shevchenko andriy.shevchenko at linux.intel.com
Thu Oct 15 18:23:27 UTC 2020


On Thu, Oct 15, 2020 at 09:21:21PM +0300, Andy Shevchenko wrote:
> On Thu, Oct 15, 2020 at 02:59:05PM -0300, Vitor Massaru Iha wrote:
> > On Thu, Oct 15, 2020 at 2:47 PM Andy Shevchenko
> > <andriy.shevchenko at linux.intel.com> wrote:
> > >
> > > On Wed, Oct 14, 2020 at 10:46:16PM -0300, Vitor Massaru Iha wrote:
> > > > This adds the conversion of the runtime tests of test_list_sort,
> > > > from `lib/test_list_sort.c` to KUnit tests.
> > >
> > > >  rename lib/{test_list_sort.c => list_sort_kunit.c} (62%)
> > >
> > > One more thing. The documentation [1] doesn't specify any name conventions.
> > > So, please leave file name untouched.
> > >
> > > [1]: https://www.kernel.org/doc/html/latest/dev-tools/kunit/index.html
> > 
> > This convention hasn't yet entered the Torvaldos tree, but it is in
> > the Shuah tree: [1]
> > 
> > +Test File and Module Names
> > +==========================
> > +
> > +KUnit tests can often be compiled as a module. These modules should be named
> > +after the test suite, followed by ``_test``. If this is likely to conflict with
> > +non-KUnit tests, the suffix ``_kunit`` can also be used.
> > +
> > +The easiest way of achieving this is to name the file containing the test suite
> > +``<suite>_test.c`` (or, as above, ``<suite>_kunit.c``). This file should be
> > +placed next to the code under test.
> > +
> > +If the suite name contains some or all of the name of the test's parent
> > +directory, it may make sense to modify the source filename to reduce
> > redundancy.
> > +For example, a ``foo_firmware`` suite could be in the ``foo/firmware_test.c``
> > +file.
> > 
> > [1] https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?h=kunit&id=2a41fc52c21b6ece49921716bd289bfebaadcc04
> 
> I see.
> 
> Can the rest of documentation be consistent with this? It seems half-baked,
> since examples show something different.
> 
> (Entire documentation if full of example-test.c)

Also it doesn't really clear about the test cases against header files, like
for list.h or bits.h. (There is no c-file and I'm not sure one desires to have
include/linux/*_kunit.c)

-- 
With Best Regards,
Andy Shevchenko




More information about the Linux-kernel-mentees mailing list