[PATCH] kunit: arch/um/configs: Enable KUNIT_ALL_TESTS by default

17 views
Skip to first unread message

David Gow

unread,
May 17, 2021, 11:58:35 PM5/17/21
to Brendan Higgins, Shuah Khan, David Gow, Jeff Dike, Richard Weinberger, kuni...@googlegroups.com, linux-k...@vger.kernel.org, linu...@lists.infradead.org, linux-...@vger.kernel.org
Make the default .kunitconfig (specified in
arch/um/configs/kunit_defconfig) specify CONFIG_KUNIT_ALL_TESTS by
default. KUNIT_ALL_TESTS runs all tests which have satisfied
dependencies in the current .config (which would be the architecture
defconfig).

Currently, the default .kunitconfig enables only the example tests and
KUnit's own tests. While this does provide a good example of what a
.kunitconfig for running a few individual tests should look like, it
does mean that kunit_tool runs a pretty paltry collection of tests by
default.

A default run of ./tools/testing/kunit/kunit.py run now runs 70 tests
instead of 14.

Signed-off-by: David Gow <davi...@google.com>
---
arch/um/configs/kunit_defconfig | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/um/configs/kunit_defconfig b/arch/um/configs/kunit_defconfig
index 9235b7d42d38..becf3432a375 100644
--- a/arch/um/configs/kunit_defconfig
+++ b/arch/um/configs/kunit_defconfig
@@ -1,3 +1,2 @@
CONFIG_KUNIT=y
-CONFIG_KUNIT_TEST=y
-CONFIG_KUNIT_EXAMPLE_TEST=y
+CONFIG_KUNIT_ALL_TESTS=y
--
2.31.1.751.gd2f1c929bd-goog

Daniel Latypov

unread,
May 18, 2021, 4:14:23 PM5/18/21
to David Gow, Brendan Higgins, Shuah Khan, Jeff Dike, Richard Weinberger, KUnit Development, open list:KERNEL SELFTEST FRAMEWORK, linu...@lists.infradead.org, Linux Kernel Mailing List
On Mon, May 17, 2021 at 8:58 PM 'David Gow' via KUnit Development
<kuni...@googlegroups.com> wrote:
>
> Make the default .kunitconfig (specified in
> arch/um/configs/kunit_defconfig) specify CONFIG_KUNIT_ALL_TESTS by
> default. KUNIT_ALL_TESTS runs all tests which have satisfied
> dependencies in the current .config (which would be the architecture
> defconfig).
>
> Currently, the default .kunitconfig enables only the example tests and
> KUnit's own tests. While this does provide a good example of what a
> .kunitconfig for running a few individual tests should look like, it
> does mean that kunit_tool runs a pretty paltry collection of tests by
> default.

From the perspective of someone trying out KUnit for the first time,
I'd personally
* try out `kunit.py run`
* then maybe grep for a test/suite name that sounds interesting.

So I'm strongly in favor of the default running a wider variety of tests.
The build and execution time is still very quick, so no complaints there.

I also think this makes the set of (most of) the existing tests more
discoverable then grepping around for #include <kunit/test.h> or
similar indicators.

But I'm also biased in that I like seeing larger numbers of tests.

>
> A default run of ./tools/testing/kunit/kunit.py run now runs 70 tests
> instead of 14.
>
> Signed-off-by: David Gow <davi...@google.com>

Acked-by: Daniel Latypov <dlat...@google.com>

> ---
> arch/um/configs/kunit_defconfig | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/um/configs/kunit_defconfig b/arch/um/configs/kunit_defconfig
> index 9235b7d42d38..becf3432a375 100644
> --- a/arch/um/configs/kunit_defconfig
> +++ b/arch/um/configs/kunit_defconfig
> @@ -1,3 +1,2 @@
> CONFIG_KUNIT=y
> -CONFIG_KUNIT_TEST=y
> -CONFIG_KUNIT_EXAMPLE_TEST=y

I think it's maybe still useful to have an example of selecting a specific test.
I'd lean towards keeping one or both of these.

KUNIT_TEST might not be as clear as KUNIT_EXAMPLE_TEST, so I'd lean
towards keeping that one, if we don't want both.


> +CONFIG_KUNIT_ALL_TESTS=y
> --
> 2.31.1.751.gd2f1c929bd-goog
>
> --
> 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/20210518035825.1885357-1-davidgow%40google.com.

Brendan Higgins

unread,
May 18, 2021, 5:15:17 PM5/18/21
to David Gow, Shuah Khan, Jeff Dike, Richard Weinberger, KUnit Development, open list:KERNEL SELFTEST FRAMEWORK, linux-um, Linux Kernel Mailing List
On Mon, May 17, 2021 at 8:58 PM David Gow <davi...@google.com> wrote:
>
> Make the default .kunitconfig (specified in
> arch/um/configs/kunit_defconfig) specify CONFIG_KUNIT_ALL_TESTS by
> default. KUNIT_ALL_TESTS runs all tests which have satisfied
> dependencies in the current .config (which would be the architecture
> defconfig).
>
> Currently, the default .kunitconfig enables only the example tests and
> KUnit's own tests. While this does provide a good example of what a
> .kunitconfig for running a few individual tests should look like, it
> does mean that kunit_tool runs a pretty paltry collection of tests by
> default.
>
> A default run of ./tools/testing/kunit/kunit.py run now runs 70 tests
> instead of 14.
>
> Signed-off-by: David Gow <davi...@google.com>

I am totally on board with what you want to do here, but I have one
minor issue below.

Reviewed-by: Brendan Higgins <brendan...@google.com>

> ---
> arch/um/configs/kunit_defconfig | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/arch/um/configs/kunit_defconfig b/arch/um/configs/kunit_defconfig
> index 9235b7d42d38..becf3432a375 100644
> --- a/arch/um/configs/kunit_defconfig
> +++ b/arch/um/configs/kunit_defconfig

Could we also apply this to
tools/testing/kunit/configs/all_tests.config ? The contents of the
file are identical, and I think are supposed to be for the same
purpose.

David Gow

unread,
May 22, 2021, 12:42:52 AM5/22/21
to Brendan Higgins, Shuah Khan, David Gow, Jeff Dike, Richard Weinberger, kuni...@googlegroups.com, linux-k...@vger.kernel.org, linu...@lists.infradead.org, linux-...@vger.kernel.org, Daniel Latypov
Make the default .kunitconfig (specified in
arch/um/configs/kunit_defconfig) specify CONFIG_KUNIT_ALL_TESTS by
default. KUNIT_ALL_TESTS runs all tests which have satisfied
dependencies in the current .config (which would be the architecture
defconfig).

Currently, the default .kunitconfig enables only the example tests and
KUnit's own tests. While this does provide a good example of what a
.kunitconfig for running a few individual tests should look like, it
does mean that kunit_tool runs a pretty paltry collection of tests by
default.

The example tests' config entry (CONFIG_KUNIT_EXAMPLE_TEST=y) continues
to be included -- despite now being redundant -- to provide an example
of how tests are enabled when KUNIT_ALL_TESTS is disabled.

A default run of ./tools/testing/kunit/kunit.py run now runs 70 tests
instead of 14.

Signed-off-by: David Gow <davi...@google.com>
Acked-by: Daniel Latypov <dlat...@google.com>
Reviewed-by: Brendan Higgins <brendan...@google.com>
---

Changes since v1:
https://lore.kernel.org/linux-kselftest/20210518035825.1...@google.com/
- Keep the KUNIT_EXAMPLE_TEST entry as an example.
- Move (in patches 2,3) kunit_defconfig to tools/testing/kunit/configs
and replace all_tests.config.

arch/um/configs/kunit_defconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/um/configs/kunit_defconfig b/arch/um/configs/kunit_defconfig
index 9235b7d42d38..e67af7b9f1bb 100644
--- a/arch/um/configs/kunit_defconfig
+++ b/arch/um/configs/kunit_defconfig
@@ -1,3 +1,3 @@
CONFIG_KUNIT=y
-CONFIG_KUNIT_TEST=y
CONFIG_KUNIT_EXAMPLE_TEST=y
+CONFIG_KUNIT_ALL_TESTS=y
--
2.31.1.818.g46aad6cb9e-goog

David Gow

unread,
May 22, 2021, 12:43:03 AM5/22/21
to Brendan Higgins, Shuah Khan, David Gow, Jeff Dike, Richard Weinberger, Jonathan Corbet, kuni...@googlegroups.com, linux-k...@vger.kernel.org, linu...@lists.infradead.org, linu...@vger.kernel.org, linux-...@vger.kernel.org
The default .kunitconfig file is currently kept in
arch/um/configs/kunit_defconfig, but -- with the impending QEMU patch
-- will no-longer be exclusively used for UML-based kernels.

Move it alongside the other KUnit configs in
tools/testing/kunit/configs, and give it a name which matches the
existing all_tests.config and broken_on_uml.config files.

Also update the Getting Started documentation to point to the new file.

Signed-off-by: David Gow <davi...@google.com>
---
Documentation/dev-tools/kunit/start.rst | 2 +-
.../testing/kunit/configs/default.config | 0
tools/testing/kunit/kunit_kernel.py | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
rename arch/um/configs/kunit_defconfig => tools/testing/kunit/configs/default.config (100%)

diff --git a/Documentation/dev-tools/kunit/start.rst b/Documentation/dev-tools/kunit/start.rst
index 0e65cabe08eb..5becb09b1751 100644
--- a/Documentation/dev-tools/kunit/start.rst
+++ b/Documentation/dev-tools/kunit/start.rst
@@ -36,7 +36,7 @@ A good starting point for a ``.kunitconfig`` is the KUnit defconfig:
.. code-block:: bash

cd $PATH_TO_LINUX_REPO
- cp arch/um/configs/kunit_defconfig .kunitconfig
+ cp tools/testing/kunit/configs/default.config .kunitconfig

You can then add any other Kconfig options you wish, e.g.:

diff --git a/arch/um/configs/kunit_defconfig b/tools/testing/kunit/configs/default.config
similarity index 100%
rename from arch/um/configs/kunit_defconfig
rename to tools/testing/kunit/configs/default.config
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index 89a7d4024e87..5b57a43de33f 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -20,7 +20,7 @@ import kunit_parser

KCONFIG_PATH = '.config'
KUNITCONFIG_PATH = '.kunitconfig'
-DEFAULT_KUNITCONFIG_PATH = 'arch/um/configs/kunit_defconfig'
+DEFAULT_KUNITCONFIG_PATH = 'tools/testing/kunit/configs/default.config'
BROKEN_ALLCONFIG_PATH = 'tools/testing/kunit/configs/broken_on_uml.config'
OUTFILE_PATH = 'test.log'

--
2.31.1.818.g46aad6cb9e-goog

David Gow

unread,
May 22, 2021, 12:43:08 AM5/22/21
to Brendan Higgins, Shuah Khan, David Gow, Jeff Dike, Richard Weinberger, kuni...@googlegroups.com, linux-k...@vger.kernel.org, linu...@lists.infradead.org, linux-...@vger.kernel.org
This isn't used anywhere. While it's possible that people were manually
referencing it, the new default config (in default.config in the same
path) provides equivalent functionality.

Signed-off-by: David Gow <davi...@google.com>
---
tools/testing/kunit/configs/all_tests.config | 3 ---
1 file changed, 3 deletions(-)
delete mode 100644 tools/testing/kunit/configs/all_tests.config

diff --git a/tools/testing/kunit/configs/all_tests.config b/tools/testing/kunit/configs/all_tests.config
deleted file mode 100644
index 9235b7d42d38..000000000000
--- a/tools/testing/kunit/configs/all_tests.config
+++ /dev/null
@@ -1,3 +0,0 @@
-CONFIG_KUNIT=y
-CONFIG_KUNIT_TEST=y
-CONFIG_KUNIT_EXAMPLE_TEST=y
--
2.31.1.818.g46aad6cb9e-goog

Brendan Higgins

unread,
Jun 16, 2021, 4:36:59 PM6/16/21
to David Gow, Shuah Khan, Jeff Dike, Richard Weinberger, Jonathan Corbet, KUnit Development, open list:KERNEL SELFTEST FRAMEWORK, linux-um, open list:DOCUMENTATION, Linux Kernel Mailing List
On Fri, May 21, 2021 at 9:43 PM David Gow <davi...@google.com> wrote:
>
> The default .kunitconfig file is currently kept in
> arch/um/configs/kunit_defconfig, but -- with the impending QEMU patch
> -- will no-longer be exclusively used for UML-based kernels.
>
> Move it alongside the other KUnit configs in
> tools/testing/kunit/configs, and give it a name which matches the
> existing all_tests.config and broken_on_uml.config files.
>
> Also update the Getting Started documentation to point to the new file.
>
> Signed-off-by: David Gow <davi...@google.com>

Reviewed-by: Brendan Higgins <brendan...@google.com>

Brendan Higgins

unread,
Jun 16, 2021, 4:41:28 PM6/16/21
to David Gow, Shuah Khan, Jeff Dike, Richard Weinberger, KUnit Development, open list:KERNEL SELFTEST FRAMEWORK, linux-um, Linux Kernel Mailing List
On Fri, May 21, 2021 at 9:43 PM David Gow <davi...@google.com> wrote:
>
> This isn't used anywhere. While it's possible that people were manually
> referencing it, the new default config (in default.config in the same
> path) provides equivalent functionality.
>
> Signed-off-by: David Gow <davi...@google.com>

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