mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-17 22:23:45 -04:00
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>
This commit is contained in:
committed by
Shuah Khan
parent
8c278d97ad
commit
a9333bd344
@@ -10,6 +10,7 @@
|
||||
import argparse
|
||||
import os
|
||||
import re
|
||||
import shlex
|
||||
import sys
|
||||
import time
|
||||
|
||||
@@ -324,6 +325,10 @@ def add_common_opts(parser) -> None:
|
||||
'a QemuArchParams object.'),
|
||||
type=str, metavar='FILE')
|
||||
|
||||
parser.add_argument('--qemu_args',
|
||||
help='Additional QEMU arguments, e.g. "-smp 8"',
|
||||
action='append', metavar='')
|
||||
|
||||
def add_build_opts(parser) -> None:
|
||||
parser.add_argument('--jobs',
|
||||
help='As in the make command, "Specifies the number of '
|
||||
@@ -369,12 +374,19 @@ def add_parse_opts(parser) -> None:
|
||||
|
||||
def tree_from_args(cli_args: argparse.Namespace) -> kunit_kernel.LinuxSourceTree:
|
||||
"""Returns a LinuxSourceTree based on the user's arguments."""
|
||||
# Allow users to specify multiple arguments in one string, e.g. '-smp 8'
|
||||
qemu_args: List[str] = []
|
||||
if cli_args.qemu_args:
|
||||
for arg in cli_args.qemu_args:
|
||||
qemu_args.extend(shlex.split(arg))
|
||||
|
||||
return kunit_kernel.LinuxSourceTree(cli_args.build_dir,
|
||||
kunitconfig_path=cli_args.kunitconfig,
|
||||
kconfig_add=cli_args.kconfig_add,
|
||||
arch=cli_args.arch,
|
||||
cross_compile=cli_args.cross_compile,
|
||||
qemu_config_path=cli_args.qemu_config)
|
||||
qemu_config_path=cli_args.qemu_config,
|
||||
extra_qemu_args=qemu_args)
|
||||
|
||||
|
||||
def main(argv):
|
||||
|
||||
Reference in New Issue
Block a user