summaryrefslogtreecommitdiff
path: root/tools/testing/kunit/kunit_kernel.py
diff options
context:
space:
mode:
authorDaniel Latypov <dlatypov@google.com>2022-05-18 10:01:24 -0700
committerShuah Khan <skhan@linuxfoundation.org>2022-07-07 18:00:05 -0600
commita9333bd344ad6eaf942221e0497ed65ec3224052 (patch)
treef55c393a4060dbe0efdff6f3c79655ab7988ce34 /tools/testing/kunit/kunit_kernel.py
parent8c278d97ad721442692e610007494e8e18cc0288 (diff)
kunit: tool: introduce --qemu_args
Example usage: $ ./tools/testing/kunit/kunit.py run --arch=x86_64 \ --kconfig_add=CONFIG_SMP=y --qemu_args='-smp 8' Looking in the test.log, one can see > smp: Bringing up secondary CPUs ... > .... node #0, CPUs: #1 #2 #3 #4 #5 #6 #7 > smp: Brought up 1 node, 8 CPUs This flag would allow people to make tweaks like this without having to create custom qemu_config files. For consistency with --kernel_args, we allow users to repeat this argument, e.g. you can tack on a --qemu_args='-m 2048', or you could just append it to the first string ('-smp 8 -m 2048'). Signed-off-by: Daniel Latypov <dlatypov@google.com> Reviewed-by: David Gow <davidgow@google.com> Reviewed-by: Brendan Higgins <brendanhiggins@google.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/testing/kunit/kunit_kernel.py')
-rw-r--r--tools/testing/kunit/kunit_kernel.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py
index eb12e97deceb..b30622aa374f 100644
--- a/tools/testing/kunit/kunit_kernel.py
+++ b/tools/testing/kunit/kunit_kernel.py
@@ -188,6 +188,7 @@ def _default_qemu_config_path(arch: str) -> str:
raise ConfigError(arch + ' is not a valid arch, options are ' + str(sorted(options)))
def _get_qemu_ops(config_path: str,
+ extra_qemu_args: Optional[List[str]],
cross_compile: Optional[str]) -> Tuple[str, LinuxSourceTreeOperations]:
# The module name/path has very little to do with where the actual file
# exists (I learned this through experimentation and could not find it
@@ -208,6 +209,8 @@ def _get_qemu_ops(config_path: str,
if not hasattr(config, 'QEMU_ARCH'):
raise ValueError('qemu_config module missing "QEMU_ARCH": ' + config_path)
params: qemu_config.QemuArchParams = config.QEMU_ARCH # type: ignore
+ if extra_qemu_args:
+ params.extra_qemu_params.extend(extra_qemu_args)
return params.linux_arch, LinuxSourceTreeOperationsQemu(
params, cross_compile=cross_compile)
@@ -221,17 +224,18 @@ class LinuxSourceTree:
kconfig_add: Optional[List[str]]=None,
arch=None,
cross_compile=None,
- qemu_config_path=None) -> None:
+ qemu_config_path=None,
+ extra_qemu_args=None) -> None:
signal.signal(signal.SIGINT, self.signal_handler)
if qemu_config_path:
- self._arch, self._ops = _get_qemu_ops(qemu_config_path, cross_compile)
+ self._arch, self._ops = _get_qemu_ops(qemu_config_path, extra_qemu_args, cross_compile)
else:
self._arch = 'um' if arch is None else arch
if self._arch == 'um':
self._ops = LinuxSourceTreeOperationsUml(cross_compile=cross_compile)
else:
qemu_config_path = _default_qemu_config_path(self._arch)
- _, self._ops = _get_qemu_ops(qemu_config_path, cross_compile)
+ _, self._ops = _get_qemu_ops(qemu_config_path, extra_qemu_args, cross_compile)
if kunitconfig_path:
if os.path.isdir(kunitconfig_path):