Skip to contentSkip to conversation

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

PATCH In review SeongJae Park 2 participants 4 messages Oct 13, 2020 – Oct 21, 2020

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Documentation: kunit: Update Kconfig parts for KUNIT's module support

From: SeongJae Park <[email protected]>

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")

---

Changes from v1
(https://lore.kernel.org/linux-kselftest/[email protected]/):
- 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(-)
Documentation/dev-tools/kunit/start.rst +1 -1
index d23385e3e159..454f307813ea 100644
@@ -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``:
 
Documentation/dev-tools/kunit/usage.rst +5 -0
index 3c3fe8b5fecc..b331f5a5b0b9 100644
@@ -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``.
+
 Writing new tests for other architectures
 -----------------------------------------
 
Signature · 1 line
2.17.1
#1 lore raw

I just realized I missed adding Marco Elver as a recipient, so adding him. Sorry, Marco.

Thanks,
SeongJae Park

Quoted 51 lines · On Tue, 13 Oct 2020 08:37:43 +0200 SeongJae Park <[email protected]> wrote:

From: SeongJae Park <[email protected]>

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")

---

Changes from v1
(https://lore.kernel.org/linux-kselftest/[email protected]/):
- 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(-)
Documentation/dev-tools/kunit/start.rst +1 -1
index d23385e3e159..454f307813ea 100644
@@ -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``:
 
Documentation/dev-tools/kunit/usage.rst +5 -0
index 3c3fe8b5fecc..b331f5a5b0b9 100644
@@ -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``.
+
 Writing new tests for other architectures
 -----------------------------------------
 
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#2 lore raw
In reply to SeongJae Park
Quoted 9 lines · SeongJae Park' via KUnit Development

From: SeongJae Park <[email protected]>

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")

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

Cheers,
-- David

Quoted 29 lines

---

Changes from v1
(https://lore.kernel.org/linux-kselftest/[email protected]/):
- 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(-)
Documentation/dev-tools/kunit/start.rst +1 -1
index d23385e3e159..454f307813ea 100644
@@ -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``:
 
Documentation/dev-tools/kunit/usage.rst +0 -0
index 3c3fe8b5fecc..b331f5a5b0b9 100644

Documentation/dev-tools/kunit/usage.rst Once the kernel is built and installed, a simple · line 560

Quoted 5 lines
Documentation/dev-tools/kunit/usage.rst +2 -0
@@ -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

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

Documentation/dev-tools/kunit/usage.rst Once the kernel is built and installed, a simple · line 563

Quoted 3 lines
Documentation/dev-tools/kunit/usage.rst +3 -0
+   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.

Quoted 10 lines
Documentation/dev-tools/kunit/usage.rst +0 -1
 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/kunit-dev/20201013063743.32179-1-sjpark%40amazon.com.

#3 lore raw
Quoted 9 lines · On Wed, 21 Oct 2020 12:06:13 +0800 David Gow <[email protected]> wrote:
Quoted 7 lines · SeongJae Park' via KUnit Development

From: SeongJae Park <[email protected]>

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.

Quoted 7 lines
Quoted 2 lines
Fixes 9fe124bf1b77 ("kunit: allow kunit to be loaded as a module")

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

Thanks!

Quoted 34 lines

Cheers,
-- David

Quoted 30 lines

---

Changes from v1
(https://lore.kernel.org/linux-kselftest/[email protected]/):
- 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(-)
Documentation/dev-tools/kunit/start.rst +1 -1
index d23385e3e159..454f307813ea 100644
@@ -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``:
 
Documentation/dev-tools/kunit/usage.rst +0 -0
index 3c3fe8b5fecc..b331f5a5b0b9 100644
@@ -556,6 +556,11 @@ Once the kernel is built and installed, a simple
 
Quoted 6 lines

Documentation/dev-tools/kunit/usage.rst Once the kernel is built and installed, a simple · line 560

Quoted 4 lines
Documentation/dev-tools/kunit/usage.rst +2 -0
 ...will run the tests.
 
+.. note::
+   Note that you should make your test depends on ``KUNIT=y`` in Kconfig if the

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

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

Thanks,
SeongJae Park