linux-doc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kees Cook <kees@kernel.org>
To: John Hubbard <jhubbard@nvidia.com>
Cc: David Gow <davidgow@google.com>,
	Brendan Higgins <brendan.higgins@linux.dev>,
	Rae Moar <rmoar@google.com>, Jonathan Corbet <corbet@lwn.net>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] Documentation: KUnit: Update filename best practices
Date: Wed, 17 Jul 2024 15:11:15 -0700	[thread overview]
Message-ID: <202407171510.88EECF3857@keescook> (raw)
In-Reply-To: <a5005f1e-5bbc-49f2-bd1f-4c4878b98d26@nvidia.com>

On Wed, Jul 17, 2024 at 02:16:30PM -0700, John Hubbard wrote:
> On 7/17/24 2:00 PM, Kees Cook wrote:
> > Based on feedback from Linus[1], change the suggested file naming for
> > KUnit tests.
> > 
> > Link: https://lore.kernel.org/lkml/CAHk-=wgim6pNiGTBMhP8Kd3tsB7_JTAuvNJ=XYd3wPvvk=OHog@mail.gmail.com/ [1]
> > Signed-off-by: Kees Cook <kees@kernel.org>
> > ---
> > Cc: David Gow <davidgow@google.com>
> > Cc: Brendan Higgins <brendan.higgins@linux.dev>
> > Cc: Rae Moar <rmoar@google.com>
> > Cc: Jonathan Corbet <corbet@lwn.net>
> > Cc: Linus Torvalds <torvalds@linux-foundation.org>
> > Cc: linux-kselftest@vger.kernel.org
> > Cc: kunit-dev@googlegroups.com
> > Cc: linux-doc@vger.kernel.org
> > ---
> >   Documentation/dev-tools/kunit/style.rst | 21 +++++++++++++--------
> >   1 file changed, 13 insertions(+), 8 deletions(-)
> > 
> > diff --git a/Documentation/dev-tools/kunit/style.rst b/Documentation/dev-tools/kunit/style.rst
> > index b6d0d7359f00..761dee3f89ca 100644
> > --- a/Documentation/dev-tools/kunit/style.rst
> > +++ b/Documentation/dev-tools/kunit/style.rst
> > @@ -188,15 +188,20 @@ For example, a Kconfig entry might look like:
> >   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.
> > +Whether a KUnit test is compiled as a separate module or via an
> > +``#include`` in a core kernel source file, the files should be named
> > +after the test suite, followed by ``_test``, and live in a ``tests``
> 
> I read the previous discussion in the other thread and thought about it.
> And ran some kunit tests on baremetal. Delightful! I love this approach.
> 
> However! It is rather distinct and not just any old test module. Kunit
> has clear conventions and behavior.
> 
> As such, I have quickly become convinced that distinct naming is
> required here. So I'd like to suggest going with the the suffix:
> 
>     _kunit
> 
> ...unconditionally. After all, sometimes you'll end up with that
> anyway, so clearly, the _test suffix isn't strictly required.
> 
> And given that we are putting these in tests/ , a _test suffix is
> redundant.
> 
> Yes?

I would agree. David, what do you think? I realize drm already does
tests/*_test.c, but it does seem like better information density to use
the tests/*_kunit.c pattern by default?

-- 
Kees Cook

  reply	other threads:[~2024-07-17 22:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-17 21:00 [PATCH] Documentation: KUnit: Update filename best practices Kees Cook
2024-07-17 21:16 ` John Hubbard
2024-07-17 22:11   ` Kees Cook [this message]
2024-07-18  5:56     ` David Gow
2024-07-18  5:56 ` David Gow

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=202407171510.88EECF3857@keescook \
    --to=kees@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=corbet@lwn.net \
    --cc=davidgow@google.com \
    --cc=jhubbard@nvidia.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=rmoar@google.com \
    --cc=torvalds@linux-foundation.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).