Re: [PATCH v4 3/3] configfs: Add unit tests

From: Christoph Hellwig
Date: Tue Aug 10 2021 - 12:50:37 EST


On Mon, Aug 09, 2021 at 11:31:23AM -0700, Bart Van Assche wrote:
> I can store this documentation in a new README, but isn't this something
> that has already been explained in
> Documentation/dev-tools/kunit/kunit-tool.rst?

So reference that.

>
> >> +config CONFIGFS_KUNIT_TEST
> >> + bool "Configfs Kunit test" if !KUNIT_ALL_TESTS
> >> + depends on CONFIGFS_FS && KUNIT=y
> >> + default KUNIT_ALL_TESTS
> >
> > Why does it depend on KUNIT=y? What is the issue with a modular KUNIT
> > build?
>
> The unit tests calls do_mount(). do_mount() has not been exported and
> hence is not available to kernel modules. Hence the exclusion of KUNIT=m.

You should probably document that. But then again this is another
big red flag that this code should live in userspace.

> > To me this sounds like userspace would be a better place for these
> > kinds of tests.
>
> Splitting the code that can only be run from inside the kernel (creation
> of configfs attributes) and the code that can be run from user space and
> making sure that the two run in a coordinated fashion would involve a
> significant amount of work. I prefer to keep the current approach.

But userspace is the right place to do this kind of pathname
based file system I/O.

So for the current in-kernel approach:

Nacked-by: Christoph Hellwig <hch@xxxxxx>