[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/9] tests/acceptance: allow console interaction with specific VM
From: |
Pavel Dovgalyuk |
Subject: |
[PATCH 1/9] tests/acceptance: allow console interaction with specific VMs |
Date: |
Mon, 25 May 2020 14:19:08 +0300 |
User-agent: |
StGit/0.17.1-dirty |
Console interaction in avocado scripts was possible only with single
default VM.
This patch modifies the function parameters to allow passing a specific
VM as a parameter to interact with it.
Signed-off-by: Pavel Dovgalyuk <address@hidden>
---
tests/acceptance/avocado_qemu/__init__.py | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/tests/acceptance/avocado_qemu/__init__.py
b/tests/acceptance/avocado_qemu/__init__.py
index 59e7b4f763..0bbaa8d2a6 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -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,7 @@ 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 +127,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):
- [PATCH 0/9] Record/replay acceptance tests, Pavel Dovgalyuk, 2020/05/25
- [PATCH 1/9] tests/acceptance: allow console interaction with specific VMs,
Pavel Dovgalyuk <=
- [PATCH 2/9] tests/acceptance: add base class record/replay kernel tests, Pavel Dovgalyuk, 2020/05/25
- [PATCH 3/9] tests/acceptance: add kernel record/replay test for x86_64, Pavel Dovgalyuk, 2020/05/25
- [PATCH 4/9] tests/acceptance: add record/replay test for aarch64, Pavel Dovgalyuk, 2020/05/25
- [PATCH 5/9] tests/acceptance: add record/replay test for arm, Pavel Dovgalyuk, 2020/05/25
- [PATCH 6/9] tests/acceptance: add record/replay test for ppc64, Pavel Dovgalyuk, 2020/05/25
- [PATCH 7/9] tests/acceptance: add record/replay test for m68k, Pavel Dovgalyuk, 2020/05/25
- [PATCH 8/9] tests/acceptance: record/replay tests with advcal images, Pavel Dovgalyuk, 2020/05/25