linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Geert Uytterhoeven <geert@linux-m68k.org>
To: David Gow <davidgow@google.com>, Jeremy Kerr <jk@codeconstruct.com.au>
Cc: "Brendan Higgins" <brendanhiggins@google.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Daniel Latypov" <dlatypov@google.com>,
	"Shuah Khan" <skhan@linuxfoundation.org>,
	"Andrew Jeffery" <andrew@aj.id.au>,
	"Mika Westerberg" <mika.westerberg@linux.intel.com>,
	"Andra Paraschiv" <andraprs@amazon.com>,
	Longpeng <longpeng2@huawei.com>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	"KUnit Development" <kunit-dev@googlegroups.com>,
	"open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Maíra Canal" <maira.canal@usp.br>,
	"Linux MMC List" <linux-mmc@vger.kernel.org>,
	linux-aspeed@lists.ozlabs.org, openbmc@lists.ozlabs.org,
	"USB list" <linux-usb@vger.kernel.org>,
	linux-modules@vger.kernel.org,
	"Matt Johnston" <matt@codeconstruct.com.au>
Subject: Re: [PATCH v4 1/5] kunit: unify module and builtin suite definitions
Date: Thu, 11 Aug 2022 15:49:26 +0200	[thread overview]
Message-ID: <CAMuHMdUdvGyMFyDSX3cSGDz9x3Q0+z1e0nQB5cB0GFazyPcK3A@mail.gmail.com> (raw)
In-Reply-To: <20220709032001.819487-2-davidgow@google.com>

Hi David, Jeremy,

On Sat, Jul 9, 2022 at 5:21 AM David Gow <davidgow@google.com> wrote:
> From: Jeremy Kerr <jk@codeconstruct.com.au>
>
> Currently, KUnit runs built-in tests and tests loaded from modules
> differently. For built-in tests, the kunit_test_suite{,s}() macro adds a
> list of suites in the .kunit_test_suites linker section. However, for
> kernel modules, a module_init() function is used to run the test suites.
>
> This causes problems if tests are included in a module which already
> defines module_init/exit_module functions, as they'll conflict with the
> kunit-provided ones.
>
> This change removes the kunit-defined module inits, and instead parses
> the kunit tests from their own section in the module. After module init,
> we call __kunit_test_suites_init() on the contents of that section,
> which prepares and runs the suite.
>
> This essentially unifies the module- and non-module kunit init formats.
>
> Tested-by: Maíra Canal <maira.canal@usp.br>
> Reviewed-by: Brendan Higgins <brendanhiggins@google.com>
> Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
> Signed-off-by: Daniel Latypov <dlatypov@google.com>
> Signed-off-by: David Gow <davidgow@google.com>

Thanks for your patch, which is now commit 3d6e44623841c8b8 ("kunit:
unify module and builtin suite definitions") upstream.

Since this commit, modular kunit tests are no longer run at all.

Before:

    # insmod lib/kunit/kunit.ko
    # insmod lib/test_hash.ko
    test_hash: loading test module taints kernel.
        # Subtest: hash
        1..2
        ok 1 - test_string_or
        ok 2 - test_hash_or
    # hash: pass:2 fail:0 skip:0 total:2
    # Totals: pass:2 fail:0 skip:0 total:2
    ok 1 - hash

After:

    # insmod lib/kunit/kunit.ko
    # insmod lib/test_hash.ko
    test_hash: loading test module taints kernel.

The actual test code (and test init code, if it exists) is not run.

Reverting commits e5857d396f35e59e ("kunit: flatten kunit_suite***
to kunit_suite** in .kunit_test_suites") and 3d6e44623841c8b8 ("kunit:
unify module and builtin suite definitions") fixes the issue.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

  reply	other threads:[~2022-08-11 13:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-09  3:19 [PATCH v4 0/5] Rework KUnit test execution in modules David Gow
2022-07-09  3:19 ` [PATCH v4 1/5] kunit: unify module and builtin suite definitions David Gow
2022-08-11 13:49   ` Geert Uytterhoeven [this message]
2022-08-11 16:55     ` David Gow
2022-08-12  8:08       ` Geert Uytterhoeven
2022-07-09  3:19 ` [PATCH v4 2/5] kunit: flatten kunit_suite*** to kunit_suite** in .kunit_test_suites David Gow
2022-07-09  3:19 ` [PATCH v4 3/5] thunderbolt: test: Use kunit_test_suite() macro David Gow
2022-07-09  3:20 ` [PATCH v4 4/5] nitro_enclaves: " David Gow
2022-07-09  3:20 ` [PATCH v4 5/5] mmc: sdhci-of-aspeed: " 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=CAMuHMdUdvGyMFyDSX3cSGDz9x3Q0+z1e0nQB5cB0GFazyPcK3A@mail.gmail.com \
    --to=geert@linux-m68k.org \
    --cc=andraprs@amazon.com \
    --cc=andrew@aj.id.au \
    --cc=brendanhiggins@google.com \
    --cc=davidgow@google.com \
    --cc=dlatypov@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jk@codeconstruct.com.au \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-aspeed@lists.ozlabs.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=longpeng2@huawei.com \
    --cc=maira.canal@usp.br \
    --cc=matt@codeconstruct.com.au \
    --cc=mcgrof@kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=skhan@linuxfoundation.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).