From 98c2f87f6df5307d8ef21b9a7fe9ee8242732f86 Mon Sep 17 00:00:00 2001 From: Vojtech Horky Date: Mon, 27 Aug 2018 21:09:12 +0200 Subject: [PATCH] Add --pass option --- htest/vm/controller.py | 6 +++++- htest/vm/qemu.py | 2 ++ vm-test.py | 9 ++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/htest/vm/controller.py b/htest/vm/controller.py index d98fd6d..cf36eaa 100755 --- a/htest/vm/controller.py +++ b/htest/vm/controller.py @@ -36,11 +36,12 @@ class VMManager: Keeps track of running virtual machines. """ - def __init__(self, controller, architecture, boot_image, memory_amount): + def __init__(self, controller, architecture, boot_image, memory_amount, extra_opts): self.controller_class = controller self.architecture = architecture self.boot_image = boot_image self.memory_amount = memory_amount + self.extra_options = extra_opts self.instances = {} self.last = None @@ -49,6 +50,7 @@ class VMManager: raise Exception("Duplicate machine name {}.".format(name)) self.instances[name] = self.controller_class(self.architecture, name, self.boot_image) self.instances[name].memory = self.memory_amount + self.instances[name].extra_options = self.extra_options self.last = name return self.instances[name] @@ -97,6 +99,8 @@ class VMController: self.vterm = [] # Amount of memory (MB) (patched by VMM manager) self.memory = 0 + # Extra command-line options (patched by VMM manager) + self.extra_options = [] pass def is_supported(self, arch): diff --git a/htest/vm/qemu.py b/htest/vm/qemu.py index 3b7dad7..87c51b4 100755 --- a/htest/vm/qemu.py +++ b/htest/vm/qemu.py @@ -127,6 +127,8 @@ class QemuVMController(VMController): cmd.append(opt) cmd.append('-monitor') cmd.append('unix:{},server,nowait'.format(self.monitor_file)) + for opt in self.extra_options: + cmd.append(opt) self.logger.debug("Starting QEMU: {}".format(format_command(cmd))) self.proc = subprocess.Popen(cmd) diff --git a/vm-test.py b/vm-test.py index 75ff806..2c2ea06 100755 --- a/vm-test.py +++ b/vm-test.py @@ -65,6 +65,13 @@ args.add_argument('--image', required=True, help='HelenOS boot image (e.g. ISO file).' ) +args.add_argument('--pass', + metavar='OPTION', + dest='pass_thru_options', + default=[], + action='append', + help='Extra options to pass through to the emulator' +) args.add_argument('--vterm-dump', metavar='FILENAME.txt', dest='vterm_dump', @@ -118,7 +125,7 @@ if controller is None: logger.error("Unsupported architecture {}.".format(config.architecture)) sys.exit(1) -vmm = VMManager(controller, config.architecture, config.boot_image, config.memory) +vmm = VMManager(controller, config.architecture, config.boot_image, config.memory, config.pass_thru_options) scenario_tasks = [] for t in scenario['tasks']: -- 2.11.4.GIT