archive mirror
 help / color / mirror / Atom feed
* [RFC v2 0/4] kunit: tool: add support for QEMU
@ 2021-04-29 20:51 Brendan Higgins
  2021-04-29 20:51 ` [RFC v2 1/4] kunit: Add 'kunit_shutdown' option Brendan Higgins
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Brendan Higgins @ 2021-04-29 20:51 UTC (permalink / raw)
  To: shuah, davidgow
  Cc: linux-kselftest, kunit-dev, linux-kernel, corbet, linux-doc,
	sboyd, keescook, frowand.list, dlatypov, Brendan Higgins

TL;DR: Add support to kunit_tool to dispatch tests via QEMU. Also add
support to immediately shutdown a kernel after running KUnit tests.


KUnit has supported running on all architectures for quite some time;
however, kunit_tool - the script commonly used to invoke KUnit tests -
has only fully supported KUnit run on UML. Its functionality has been
broken up for some time to separate the configure, build, run, and parse
phases making it possible to be used in part on other architectures to a
small extent. Nevertheless, kunit_tool has not supported running tests
on other architectures.

What this patchset does

This patchset introduces first class support to kunit_tool for KUnit to
be run on many popular architectures via QEMU. It does this by adding
two new flags: `--arch` and `--cross_compile`.

`--arch` allows an architecture to be specified by the name the
architecture is given in `arch/`. It uses the specified architecture to
select a minimal amount of Kconfigs and QEMU configs needed for the
architecture to run in QEMU and provide a console from which KTAP
results can be scraped.

`--cross_compile` allows a toolchain prefix to be specified to make
similar to how `CROSS_COMPILE` is used.

Additionally, this patchset revives the previously considered "kunit:
tool: add support for QEMU"[1] patchs. The motivation for this new
kernel command line flags, `kunit_shutdown`, is to better support
running KUnit tests inside of QEMU. For most popular architectures, QEMU
can be made to terminate when the Linux kernel that is being run is
reboted, halted, or powered off. As Kees pointed out in a previous
discussion[2], it is possible to make a kernel initrd that can reboot
the kernel immediately, doing this for every architecture would likely
be infeasible. Instead, just having an option for the kernel to shutdown
when it is done with testing seems a lot simpler, especially since it is
an option which would only available in testing configurations of the
kernel anyway.

What discussion remains for this patchset?

The first most obvious thing is settling the debate about
`kunit_shutdown`. If I recall correctly, Kees suggested that it might be
better to just add a new initrd; however, as I mentioned above, now to
support many new architectures, it may be substantially easier to
support this option. So I am hoping with this new usecase, the argument
for `kunit_shutdown` will be more compelling.

The second and likely harder issue is figuring out the best way to
configure and provide configs for running KUnit tests via QEMU. I
provide a pretty primitive way in this patchset which is not super
flexible; for example, for our PPC support we have it set to build big
endian, and POWER8 - we currently don't support a way to change that.
Nevertheless, having sensible defaults is handy too, so we will probably
want to have some support for overriding defaults, while still being
able to have defaults.


Brendan Higgins (3):
  Documentation: Add kunit_shutdown to kernel-parameters.txt
  kunit: tool: add support for QEMU
  Documentation: kunit: document support for QEMU in kunit_tool

David Gow (1):
  kunit: Add 'kunit_shutdown' option

 .../admin-guide/kernel-parameters.txt         |   8 +
 Documentation/dev-tools/kunit/usage.rst       |  37 +++-
 lib/kunit/executor.c                          |  20 ++
 tools/testing/kunit/                  |  33 ++-
 tools/testing/kunit/           |   2 +-
 tools/testing/kunit/           | 209 +++++++++++++++---
 tools/testing/kunit/           |   2 +-
 tools/testing/kunit/        |  15 +-
 8 files changed, 278 insertions(+), 48 deletions(-)

base-commit: 7af08140979a6e7e12b78c93b8625c8d25b084e2

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-05-04 20:08 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-29 20:51 [RFC v2 0/4] kunit: tool: add support for QEMU Brendan Higgins
2021-04-29 20:51 ` [RFC v2 1/4] kunit: Add 'kunit_shutdown' option Brendan Higgins
2021-04-29 21:52   ` Daniel Latypov
2021-04-29 20:51 ` [RFC v2 2/4] Documentation: Add kunit_shutdown to kernel-parameters.txt Brendan Higgins
2021-04-29 20:51 ` [RFC v2 3/4] kunit: tool: add support for QEMU Brendan Higgins
2021-04-29 23:39   ` Daniel Latypov
2021-04-30 20:01     ` Brendan Higgins
2021-04-30 20:14       ` Daniel Latypov
2021-05-03 21:19         ` Brendan Higgins
2021-05-04  6:08   ` David Gow
2021-05-04 20:07     ` Brendan Higgins
2021-04-29 20:51 ` [RFC v2 4/4] Documentation: kunit: document support for QEMU in kunit_tool Brendan Higgins

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