All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
From: Rae Moar <rmoar@google.com>
To: Scott Mayhew <smayhew@redhat.com>
Cc: brendanhiggins@google.com, davidgow@google.com,
	npache@redhat.com,  linux-kselftest@vger.kernel.org,
	kunit-dev@googlegroups.com,  linux-nfs@vger.kernel.org
Subject: Re: [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test
Date: Thu, 21 Mar 2024 19:22:20 -0400	[thread overview]
Message-ID: <CA+GJov6XaVHsBD8NjMAUP476uxeup=Gv_2tc2ajUEkcFRZO+ng@mail.gmail.com> (raw)
In-Reply-To: <20240321143200.1854489-1-smayhew@redhat.com>

On Thu, Mar 21, 2024 at 10:32 AM Scott Mayhew <smayhew@redhat.com> wrote:
>
> Commit c72a870926c2 added a mutex to prevent kunit tests from running
> concurrently.  Unfortunately that mutex gets locked during module load
> regardless of whether the module actually has any kunit tests.  This
> causes a problem for kunit tests that might need to load other kernel
> modules (e.g. gss_krb5_test loading the camellia module).
>
> So check to see if there are actually any tests to run before locking
> the kunit_run_lock mutex.
>
> Fixes: c72a870926c2 ("kunit: add ability to run tests after boot using debugfs")
> Reported-by: Nico Pache <npache@redhat.com>
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>

Hi!

Sorry about this bug. Thanks for the patch! We should definitely add this check.

Reviewed-by: Rae Moar <rmoar@google.com>

Thanks!

-Rae

> ---
>  lib/kunit/test.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/kunit/test.c b/lib/kunit/test.c
> index 1d1475578515..b8514dbb337c 100644
> --- a/lib/kunit/test.c
> +++ b/lib/kunit/test.c
> @@ -712,6 +712,9 @@ int __kunit_test_suites_init(struct kunit_suite * const * const suites, int num_
>  {
>         unsigned int i;
>
> +       if (num_suites == 0)
> +               return 0;
> +
>         if (!kunit_enabled() && num_suites > 0) {
>                 pr_info("kunit: disabled\n");
>                 return 0;
> --
> 2.43.0
>

  reply	other threads:[~2024-03-21 23:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-07 14:09 [BUG REPORT] not ok 1 Derive Kc subkey for camellia128-cts-cmac Nico Pache
2024-03-19 17:51 ` Scott Mayhew
2024-03-20 20:16   ` Nico Pache
2024-03-21 14:24     ` Scott Mayhew
2024-03-21 14:32     ` [PATCH] kunit: bail out early in __kunit_test_suites_init() if there are no suites to test Scott Mayhew
2024-03-21 23:22       ` Rae Moar [this message]
2024-03-23  5:24       ` David Gow
2024-04-30 13:58         ` Scott Mayhew
2024-05-02  0:01           ` 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='CA+GJov6XaVHsBD8NjMAUP476uxeup=Gv_2tc2ajUEkcFRZO+ng@mail.gmail.com' \
    --to=rmoar@google.com \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=npache@redhat.com \
    --cc=smayhew@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.