[PATCH] Documentation: kunit: Update Kconfig parts for KUNIT's module support

14 views
Skip to first unread message

SeongJae Park

unread,
Oct 12, 2020, 6:54:48 AM10/12/20
to brendan...@google.com, SeongJae Park, cor...@lwn.net, sk...@linuxfoundation.org, linux-k...@vger.kernel.org, kuni...@googlegroups.com, linu...@vger.kernel.org, linux-...@vger.kernel.org
From: SeongJae Park <sjp...@amazon.de>

If 'CONFIG_KUNIT=m', letting kunit tests that do not support loadable
module build depends on 'KUNIT' instead of 'KUNIT=y' result in compile
errors. This commit updates the document for this.

Fixes: 9fe124bf1b77 ("kunit: allow kunit to be loaded as a module")
Signed-off-by: SeongJae Park <sjp...@amazon.de>
---
Documentation/dev-tools/kunit/start.rst | 2 +-
Documentation/dev-tools/kunit/usage.rst | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst
index d23385e3e159..454f307813ea 100644
--- a/Documentation/dev-tools/kunit/start.rst
+++ b/Documentation/dev-tools/kunit/start.rst
@@ -197,7 +197,7 @@ Now add the following to ``drivers/misc/Kconfig``:

config MISC_EXAMPLE_TEST
bool "Test for my example"
- depends on MISC_EXAMPLE && KUNIT
+ depends on MISC_EXAMPLE && KUNIT=y

and the following to ``drivers/misc/Makefile``:

diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-tools/kunit/usage.rst
index 3c3fe8b5fecc..410380fc7fb4 100644
--- a/Documentation/dev-tools/kunit/usage.rst
+++ b/Documentation/dev-tools/kunit/usage.rst
@@ -556,6 +556,11 @@ Once the kernel is built and installed, a simple

...will run the tests.

+.. note::
+ Note that you should make your test depends on ``KUNIT=y`` in Kcofig if the
+ test does not support module build. Otherwise, it will trigger compile
+ errors if ``CONFIG_KUNIT`` is ``m``.
+
Writing new tests for other architectures
-----------------------------------------

--
2.17.1

Marco Elver

unread,
Oct 12, 2020, 7:28:54 AM10/12/20
to SeongJae Park, Brendan Higgins, SeongJae Park, Jonathan Corbet, sk...@linuxfoundation.org, open list:KERNEL SELFTEST FRAMEWORK, KUnit Development, open list:DOCUMENTATION, LKML
s/Kcofig/Kconfig/

> Writing new tests for other architectures
> -----------------------------------------
>
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20201012105420.5945-1-sjpark%40amazon.com.

SeongJae Park

unread,
Oct 12, 2020, 2:20:11 PM10/12/20
to Marco Elver, SeongJae Park, Brendan Higgins, SeongJae Park, Jonathan Corbet, sk...@linuxfoundation.org, open list:KERNEL SELFTEST FRAMEWORK, KUnit Development, open list:DOCUMENTATION, LKML
Thanks, I will fix this in the next version of this patch.


Thanks,
SeongJae Park

SeongJae Park

unread,
Oct 13, 2020, 2:38:16 AM10/13/20
to brendan...@google.com, SeongJae Park, cor...@lwn.net, sk...@linuxfoundation.org, linux-k...@vger.kernel.org, kuni...@googlegroups.com, linu...@vger.kernel.org, linux-...@vger.kernel.org
From: SeongJae Park <sjp...@amazon.de>

If 'CONFIG_KUNIT=m', letting kunit tests that do not support loadable
module build depends on 'KUNIT' instead of 'KUNIT=y' result in compile
errors. This commit updates the document for this.

Fixes: 9fe124bf1b77 ("kunit: allow kunit to be loaded as a module")
Signed-off-by: SeongJae Park <sjp...@amazon.de>
---

Changes from v1
(https://lore.kernel.org/linux-kselftest/20201012105420...@amazon.com/):
- Fix a typo (Marco Elver)

---
Documentation/dev-tools/kunit/start.rst | 2 +-
Documentation/dev-tools/kunit/usage.rst | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst
index d23385e3e159..454f307813ea 100644
--- a/Documentation/dev-tools/kunit/start.rst
+++ b/Documentation/dev-tools/kunit/start.rst
@@ -197,7 +197,7 @@ Now add the following to ``drivers/misc/Kconfig``:

config MISC_EXAMPLE_TEST
bool "Test for my example"
- depends on MISC_EXAMPLE && KUNIT
+ depends on MISC_EXAMPLE && KUNIT=y

and the following to ``drivers/misc/Makefile``:

diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-tools/kunit/usage.rst
index 3c3fe8b5fecc..b331f5a5b0b9 100644
--- a/Documentation/dev-tools/kunit/usage.rst
+++ b/Documentation/dev-tools/kunit/usage.rst
@@ -556,6 +556,11 @@ Once the kernel is built and installed, a simple

...will run the tests.

+.. note::
+ Note that you should make your test depends on ``KUNIT=y`` in Kconfig if the
+ test does not support module build. Otherwise, it will trigger compile
+ errors if ``CONFIG_KUNIT`` is ``m``.
+

SeongJae Park

unread,
Oct 20, 2020, 2:58:55 AM10/20/20
to SeongJae Park, brendan...@google.com, SeongJae Park, cor...@lwn.net, sk...@linuxfoundation.org, linux-k...@vger.kernel.org, kuni...@googlegroups.com, linu...@vger.kernel.org, linux-...@vger.kernel.org, el...@google.com
I just realized I missed adding Marco Elver as a recipient, so adding him.
Sorry, Marco.


Thanks,
SeongJae Park

David Gow

unread,
Oct 21, 2020, 12:06:26 AM10/21/20
to SeongJae Park, Brendan Higgins, SeongJae Park, Jonathan Corbet, Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK, KUnit Development, open list:DOCUMENTATION, Linux Kernel Mailing List
On Tue, Oct 13, 2020 at 2:38 PM 'SeongJae Park' via KUnit Development
<kuni...@googlegroups.com> wrote:
>
> From: SeongJae Park <sjp...@amazon.de>
>
> If 'CONFIG_KUNIT=m', letting kunit tests that do not support loadable
> module build depends on 'KUNIT' instead of 'KUNIT=y' result in compile
> errors. This commit updates the document for this.
>
> Fixes: 9fe124bf1b77 ("kunit: allow kunit to be loaded as a module")
> Signed-off-by: SeongJae Park <sjp...@amazon.de>

Sorry for the delay in looking at this. Apart from another minuscule
typo below, this looks good to me.

Reviewed-by: David Gow <davi...@google.com>

Cheers,
-- David
nit: Grammatically, this should technically be either "depend" (2nd
person), or something like "make sure [that] your test depends".

> + test does not support module build. Otherwise, it will trigger compile
> + errors if ``CONFIG_KUNIT`` is ``m``.
> +

Someday it'd be nice to better discuss the reasons a test suite might
not be compilable as a module. It's probably outside the scope of this
commit to do it properly, though.

> Writing new tests for other architectures
> -----------------------------------------
>
> --
> 2.17.1
>
> --
> You received this message because you are subscribed to the Google Groups "KUnit Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to kunit-dev+...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20201013063743.32179-1-sjpark%40amazon.com.

SeongJae Park

unread,
Oct 21, 2020, 3:26:16 PM10/21/20
to David Gow, SeongJae Park, Brendan Higgins, SeongJae Park, Jonathan Corbet, Shuah Khan, open list:KERNEL SELFTEST FRAMEWORK, KUnit Development, open list:DOCUMENTATION, Linux Kernel Mailing List
On Wed, 21 Oct 2020 12:06:13 +0800 David Gow <davi...@google.com> wrote:

> On Tue, Oct 13, 2020 at 2:38 PM 'SeongJae Park' via KUnit Development
> <kuni...@googlegroups.com> wrote:
> >
> > From: SeongJae Park <sjp...@amazon.de>
> >
> > If 'CONFIG_KUNIT=m', letting kunit tests that do not support loadable
> > module build depends on 'KUNIT' instead of 'KUNIT=y' result in compile
> > errors. This commit updates the document for this.
> >
> > Fixes: 9fe124bf1b77 ("kunit: allow kunit to be loaded as a module")
> > Signed-off-by: SeongJae Park <sjp...@amazon.de>
>
> Sorry for the delay in looking at this. Apart from another minuscule
> typo below, this looks good to me.
>
> Reviewed-by: David Gow <davi...@google.com>

Thanks!
Good eye! I will fix this in the next version.


Thanks,
SeongJae Park

SeongJae Park

unread,
Oct 21, 2020, 3:32:21 PM10/21/20
to brendan...@google.com, cor...@lwn.net, SeongJae Park, sk...@linuxfoundation.org, davi...@google.com, linux-k...@vger.kernel.org, kuni...@googlegroups.com, linu...@vger.kernel.org, linux-...@vger.kernel.org
From: SeongJae Park <sjp...@amazon.de>

If 'CONFIG_KUNIT=m', letting kunit tests that do not support loadable
module build depends on 'KUNIT' instead of 'KUNIT=y' result in compile
errors. This commit updates the document for this.

Fixes: 9fe124bf1b77 ("kunit: allow kunit to be loaded as a module")
Signed-off-by: SeongJae Park <sjp...@amazon.de>
Reviewed-by: David Gow <davi...@google.com>
---

Changes from v2
(https://lore.kernel.org/linux-kselftest/20201013063743...@amazon.com/)
- Fix a grammar issue (David Gow)
- Add 'Reviewed-by: David Gow <davi...@google.com>'

Changes from v1
(https://lore.kernel.org/linux-kselftest/20201012105420...@amazon.com/)
- Fix a typo (Marco Elver)

---

Documentation/dev-tools/kunit/start.rst | 2 +-
Documentation/dev-tools/kunit/usage.rst | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst
index d23385e3e159..454f307813ea 100644
--- a/Documentation/dev-tools/kunit/start.rst
+++ b/Documentation/dev-tools/kunit/start.rst
@@ -197,7 +197,7 @@ Now add the following to ``drivers/misc/Kconfig``:

config MISC_EXAMPLE_TEST
bool "Test for my example"
- depends on MISC_EXAMPLE && KUNIT
+ depends on MISC_EXAMPLE && KUNIT=y

and the following to ``drivers/misc/Makefile``:

diff --git a/Documentation/dev-tools/kunit/usage.rst b/Documentation/dev-tools/kunit/usage.rst
index 961d3ea3ca19..62142a47488c 100644
--- a/Documentation/dev-tools/kunit/usage.rst
+++ b/Documentation/dev-tools/kunit/usage.rst
@@ -561,6 +561,11 @@ Once the kernel is built and installed, a simple

...will run the tests.

+.. note::
+ Note that you should make sure your test depends on ``KUNIT=y`` in Kconfig
+ if the test does not support module build. Otherwise, it will trigger
+ compile errors if ``CONFIG_KUNIT`` is ``m``.
+

Brendan Higgins

unread,
Oct 21, 2020, 4:44:34 PM10/21/20
to SeongJae Park, Jonathan Corbet, SeongJae Park, Shuah Khan, David Gow, open list:KERNEL SELFTEST FRAMEWORK, KUnit Development, open list:DOCUMENTATION, Linux Kernel Mailing List
On Wed, Oct 21, 2020 at 12:32 PM SeongJae Park <sjp...@amazon.com> wrote:
>
> From: SeongJae Park <sjp...@amazon.de>
>
> If 'CONFIG_KUNIT=m', letting kunit tests that do not support loadable
> module build depends on 'KUNIT' instead of 'KUNIT=y' result in compile
> errors. This commit updates the document for this.
>
> Fixes: 9fe124bf1b77 ("kunit: allow kunit to be loaded as a module")
> Signed-off-by: SeongJae Park <sjp...@amazon.de>
> Reviewed-by: David Gow <davi...@google.com>

Reviewed-by: Brendan Higgins <brendan...@google.com>
Reply all
Reply to author
Forward
0 new messages