LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Brendan Higgins <brendanhiggins@google.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Shuah Khan <skhan@linuxfoundation.org>,
	Christoph Hellwig <hch@lst.de>, Joel Becker <jlbec@evilplan.org>,
	linux-kernel@vger.kernel.org,
	Bodo Stroesser <bostroesser@gmail.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Yanko Kaneti <yaneti@declera.com>,
	KUnit Development <kunit-dev@googlegroups.com>
Subject: Re: [PATCH v4 3/3] configfs: Add unit tests
Date: Tue, 1 Mar 2022 15:03:14 -0500	[thread overview]
Message-ID: <CAFd5g44vkQ1jiKa1YQ2g8ByHMOiA0rFGS1nRuYk-Dunr-aFHyA@mail.gmail.com> (raw)
In-Reply-To: <CAFd5g45hMt9OwAVDVuxLNa2EfkTH0tY=KS_qxoUmndPYDvnyig@mail.gmail.com>

On Wed, Aug 11, 2021 at 5:00 AM Brendan Higgins
<brendanhiggins@google.com> wrote:
>
> On Tue, Aug 10, 2021 at 1:50 PM Shuah Khan <skhan@linuxfoundation.org> wrote:
> >
> > On 8/10/21 12:45 PM, Bart Van Assche wrote:
> > > On 8/10/21 9:50 AM, Christoph Hellwig wrote:
> > >> On Mon, Aug 09, 2021 at 11:31:23AM -0700, Bart Van Assche wrote:
> > >>>>> +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.
> > >
> > > Shuah, as selftest maintainer, can you recommend an approach? How about splitting patch 3/3 from this series into a kernel module (the code that creates the configfs test attributes) and user space code (the code that reads and writes the configfs attributes) and adding the user space code in a subdirectory of tools/testing/selftests/?
> > >
> >
> > I am missing a lot of context here. I don't see this series in my inbox
> > except patch 2/3 which says:
> >
> > "A common feature of unit testing frameworks is support for sharing a test
> > configuration across multiple unit tests. Add this functionality to the
> > KUnit framework. This functionality will be used in the next patch in this
> > series."
>
> Yeah, I mentioned this to one of the other KUnit people who said he
> might want to post some comments. Bart, could you CC
> kunit-dev@googlegroups.com and/or linux-kselftest@vger.kernel.org
> if/when you send follow-up patches?
>
> Actually, I suppose regardless of what you do with this patch, you
> will probably want to merge via the kselftest tree (KUnit changes and
> many tests go through the kselftest tree as well). So, you should
> probably CC linux-kselftest@vger.kernel.org no matter what.
>
> > That doesn't tell me much other than what happens that it is a common unit
> > testing framework without explaining why it should be done this way.
> >
> > Taking a quick look at the original message on lore - I agree with Christoph
> > that this code belongs in userspace. I would like to see the division of
> > kernel userspace.
> >
> > Why do the unit tests need to call do_mount() - can whatever the unit tests
> > are currently doing can be done from userspace.
> >
> > If part of the test code must live in kernel space then kernel test module
> > approach can be used.

I am not sure if you are still working on this test or not, but Kees
recently posted a patch to create a KUnit UAPI:
https://lore.kernel.org/lkml/20220227184517.504931-8-keescook@chromium.org/

Not sure if you have any interest, or even if this would be the right
tool for the job, but I figured it's worth a look because it might
save you the effort of having to completely rewrite your test.

Cheers

  reply	other threads:[~2022-03-01 20:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-05  4:35 [PATCH v4 0/3] Restore the kernel v5.13 text attribute write behavior Bart Van Assche
2021-08-05  4:35 ` [PATCH v4 1/3] configfs: " Bart Van Assche
2021-08-05  4:35 ` [PATCH v4 2/3] kunit: Add support for suite initialization and cleanup Bart Van Assche
2021-08-05  4:35 ` [PATCH v4 3/3] configfs: Add unit tests Bart Van Assche
2021-08-09 14:59   ` Christoph Hellwig
2021-08-09 18:31     ` Bart Van Assche
2021-08-10 16:50       ` Christoph Hellwig
2021-08-10 18:45         ` Bart Van Assche
2021-08-10 20:50           ` Shuah Khan
2021-08-11  9:00             ` Brendan Higgins
2022-03-01 20:03               ` Brendan Higgins [this message]
2021-08-10 22:00     ` Brendan Higgins
2021-08-11  3:13       ` Bart Van Assche
2021-08-09 14:56 ` [PATCH v4 0/3] Restore the kernel v5.13 text attribute write behavior Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFd5g44vkQ1jiKa1YQ2g8ByHMOiA0rFGS1nRuYk-Dunr-aFHyA@mail.gmail.com \
    --to=brendanhiggins@google.com \
    --cc=bostroesser@gmail.com \
    --cc=bvanassche@acm.org \
    --cc=hch@lst.de \
    --cc=jlbec@evilplan.org \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=skhan@linuxfoundation.org \
    --cc=yaneti@declera.com \
    --subject='Re: [PATCH v4 3/3] configfs: Add unit tests' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).