@@ -69,13 +69,15 @@ def pick_default_qemu_bin(arch=None):
def _console_interaction(test, success_message, failure_message,
- send_string, keep_sending=False):
+ send_string, keep_sending=False, vm=None):
assert not keep_sending or send_string
- console = test.vm.console_socket.makefile()
+ if vm is None:
+ vm = test.vm
+ console = vm.console_socket.makefile()
console_logger = logging.getLogger('console')
while True:
if send_string:
- test.vm.console_socket.sendall(send_string.encode())
+ vm.console_socket.sendall(send_string.encode())
if not keep_sending:
send_string = None # send only once
msg = console.readline().strip()
@@ -115,7 +117,8 @@ def interrupt_interactive_console_until_pattern(test, success_message,
_console_interaction(test, success_message, failure_message,
interrupt_string, True)
-def wait_for_console_pattern(test, success_message, failure_message=None):
+def wait_for_console_pattern(test, success_message, failure_message=None,
+ vm=None):
"""
Waits for messages to appear on the console, while logging the content
@@ -125,7 +128,7 @@ def wait_for_console_pattern(test, success_message, failure_message=None):
:param success_message: if this message appears, test succeeds
:param failure_message: if this message appears, test fails
"""
- _console_interaction(test, success_message, failure_message, None)
+ _console_interaction(test, success_message, failure_message, None, vm=vm)
def exec_command_and_wait_for_pattern(test, command,
success_message, failure_message=None):