[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 11/19] Boot Linux Console Test: refactor the cons
From: |
Cleber Rosa |
Subject: |
[Qemu-devel] [PATCH v4 11/19] Boot Linux Console Test: refactor the console watcher into utility method |
Date: |
Tue, 12 Mar 2019 08:11:42 -0400 |
This introduces a utility method that monitors the console device and
looks for either a message that signals the test success or failure.
Signed-off-by: Cleber Rosa <address@hidden>
Reviewed-by: Caio Carrara <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Reviewed-by: Cornelia Huck <address@hidden>
---
tests/acceptance/boot_linux_console.py | 30 ++++++++++++++++++--------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/tests/acceptance/boot_linux_console.py
b/tests/acceptance/boot_linux_console.py
index c3f94e7a8c..5575ab15d6 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -23,6 +23,25 @@ class BootLinuxConsole(Test):
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+ def wait_for_console_pattern(self, success_message,
+ failure_message='Kernel panic - not syncing'):
+ """
+ Waits for messages to appear on the console, while logging the content
+
+ :param success_message: if this message appears, test succeeds
+ :param failure_message: if this message appears, test fails
+ """
+ console = self.vm.console_socket.makefile()
+ console_logger = logging.getLogger('console')
+ while True:
+ msg = console.readline()
+ console_logger.debug(msg.strip())
+ if success_message in msg:
+ break
+ if failure_message in msg:
+ fail = 'Failure message found in console: %s' % failure_message
+ self.fail(fail)
+
def test_x86_64_pc(self):
"""
:avocado: tags=arch:x86_64
@@ -39,12 +58,5 @@ class BootLinuxConsole(Test):
self.vm.add_args('-kernel', kernel_path,
'-append', kernel_command_line)
self.vm.launch()
- console = self.vm.console_socket.makefile()
- console_logger = logging.getLogger('console')
- while True:
- msg = console.readline()
- console_logger.debug(msg.strip())
- if 'Kernel command line: %s' % kernel_command_line in msg:
- break
- if 'Kernel panic - not syncing' in msg:
- self.fail("Kernel panic reached")
+ console_pattern = 'Kernel command line: %s' % kernel_command_line
+ self.wait_for_console_pattern(console_pattern)
--
2.20.1
- [Qemu-devel] [PATCH v4 00/19] Acceptance Tests: target architecture support, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 17/19] Boot Linux Console Test: add a test for arm + virt, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 19/19] Boot Linux Console Test: add a test for alpha + clipper, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 18/19] Boot Linux Console Test: add a test for s390x + s390-ccw-virtio, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 16/19] Boot Linux Console Test: add a test for aarch64 + virt, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 14/19] Boot Linux Console Test: add a test for mips64el + malta, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 15/19] Boot Linux Console Test: add a test for ppc64 + pseries, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 12/19] scripts/qemu.py: support adding a console with the default serial device, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 11/19] Boot Linux Console Test: refactor the console watcher into utility method,
Cleber Rosa <=
- [Qemu-devel] [PATCH v4 10/19] Boot Linux Console Test: increase timeout, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 09/19] Boot Linux Console Test: add common kernel command line options, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 08/19] Boot Linux Console Test: update the x86_64 kernel, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 13/19] Boot Linux Console Test: add a test for mips + malta, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 04/19] Acceptance tests: introduce arch parameter and attribute, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 06/19] Acceptance tests: look for target architecture in test tags first, Cleber Rosa, 2019/03/12
- [Qemu-devel] [PATCH v4 07/19] Boot Linux Console Test: rename the x86_64 after the arch and machine, Cleber Rosa, 2019/03/12