kunit: tool: add support for QEMU
RFC 1/1 kunit: tool: add support for QEMU
Add basic support to run QEMU via kunit_tool. Add support for i386, x86_64, arm, arm64, and a couple others.
---
This patch is very RFC; nevertheless, I wanted to get it out onto the list before I fix some of the more obvious problems.
In particular, the most obvious issue is what to do about dependencies namely QEMU and toolchains. Part of me thinks that we should do the normal toolchain prefix thing, but it is really handy to specify to switch between complier versions and QEMU versions with a single flag.
Another idea is to install needed dependencies like what 0day does with its build scripts.
Another note: I only included the most straightforwardly working architectures for this initial patch; namely all the architectures which work with a toolchain and a QEMU architecture available on the Debian apt repos and otherwise don't require changes to kunit_tool which are too radical.
Ideas are welcomed!
--- tools/testing/kunit/kunit.py | 14 +- tools/testing/kunit/kunit_config.py | 2 +- tools/testing/kunit/kunit_kernel.py | 201 +++++++++++++++++++++++++--- 3 files changed, 195 insertions(+), 22 deletions(-)
tools/testing/kunit/kunit.py +9 -5
@@ -76,10 +76,10 @@ def build_tests(linux: kunit_kernel.LinuxSourceTree, kunit_parser.print_with_timestamp('Building KUnit Kernel ...') build_start = time.time() - success = linux.build_um_kernel(request.alltests, - request.jobs, - request.build_dir, - request.make_options) + success = linux.build_kernel(request.alltests, + request.jobs, + request.build_dir, + request.make_options) build_end = time.time() if not success: return KunitResult(KunitStatus.BUILD_FAILURE,
@@ -235,6 +235,10 @@ def main(argv, linux=None): help='Specifies the file to read results from.', type=str, nargs='?', metavar='input_file') + run_parser.add_argument('--arch', + help='Specifies the architecture to run tests under.', + type=str, default='um', metavar='arch') + cli_args = parser.parse_args(argv) if cli_args.subcommand == 'run':
@@ -248,7 +252,7 @@ def main(argv, linux=None): create_default_kunitconfig() if not linux: - linux = kunit_kernel.LinuxSourceTree() + linux = kunit_kernel.LinuxSourceTree(arch=cli_args.arch) request = KunitRequest(cli_args.raw_output, cli_args.timeout,
tools/testing/kunit/kunit_config.py +1 -1
@@ -53,7 +53,7 @@ class Kconfig(object): return True def write_to_file(self, path: str) -> None: - with open(path, 'w') as f: + with open(path, 'a+') as f: for entry in self.entries(): f.write(str(entry) + '\n')
tools/testing/kunit/kunit_kernel.py +185 -16
285 lines not on this page · raw message
base-commit: 4333a9b0b67bb4e8bcd91bdd80da80b0ec151162
prerequisite-patch-id: 2d4b5aa9fa8ada9ae04c8584b47c299a822b9455
prerequisite-patch-id: 582b6d9d28ce4b71628890ec832df6522ca68de0
prerequisite-patch-id: 97b0f3dca8a284c6f5b14fac7f10a97def18610d
prerequisite-patch-id: 4b806b7fc93ca6464395d8e193378bff4b2f5c5e
prerequisite-patch-id: 25411ef134020a4711e72f464cfeee486e1cca67
prerequisite-patch-id: 91f01e8965eedc34327e871f4a6a33187c94aeaf
prerequisite-patch-id: 2a32d1d634e155a4a933d8f902ab717bf03ca487
prerequisite-patch-id: 00b3e340d3463d2ed7872400dd408b9188652553
prerequisite-patch-id: ee2aef0c799110f798f99f3a713f7e905595ec7b
prerequisite-patch-id: a99bf1505ed65027369f3cf71e45bca2b7e07d9b
prerequisite-patch-id: 8c9d94f6e7ffefa30597e9b68fba32d3c3407205
prerequisite-patch-id: 31d4fd7c057aca679253e6af504efc215ec50716
prerequisite-patch-id: 239e1866d9237e84fb626d91330c13ea0b8bae86
Signature · 1 line
2.27.0.212.ge8ba1cc988-goog