|
|
1bdc94 |
From fd8563f0e3d4697334188aa25ff92f0655752602 Mon Sep 17 00:00:00 2001
|
|
|
1bdc94 |
From: Yash Mankad <ymankad@redhat.com>
|
|
|
1bdc94 |
Date: Tue, 17 Jul 2018 23:38:08 +0200
|
|
|
1bdc94 |
Subject: [PATCH 51/89] Acceptance tests: add Linux kernel boot and console
|
|
|
1bdc94 |
checking test
|
|
|
1bdc94 |
|
|
|
1bdc94 |
RH-Author: Yash Mankad <ymankad@redhat.com>
|
|
|
1bdc94 |
Message-id: <3a22fbea648a71abf84257d69931075cafe3340e.1531870629.git.ymankad@redhat.com>
|
|
|
1bdc94 |
Patchwork-id: 81380
|
|
|
1bdc94 |
O-Subject: [RHV-7.6 qemu-kvm-rhev PATCH 5/5] Acceptance tests: add Linux kernel boot and console checking test
|
|
|
1bdc94 |
Bugzilla:
|
|
|
1bdc94 |
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: John Snow <jsnow@redhat.com>
|
|
|
1bdc94 |
RH-Acked-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
From: Cleber Rosa <crosa@redhat.com>
|
|
|
1bdc94 |
|
|
|
1bdc94 |
This test boots a Linux kernel, and checks that the given command
|
|
|
1bdc94 |
line was effective in two ways:
|
|
|
1bdc94 |
|
|
|
1bdc94 |
* It makes the kernel use the set "console device" as a console
|
|
|
1bdc94 |
* The kernel records the command line as expected in the console
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Given that way too many error conditions may occur, and detecting the
|
|
|
1bdc94 |
kernel boot progress status may not be trivial, this test relies on a
|
|
|
1bdc94 |
timeout to handle unexpected situations. Also, it's *not* tagged as a
|
|
|
1bdc94 |
quick test for obvious reasons.
|
|
|
1bdc94 |
|
|
|
1bdc94 |
It may be useful, while interactively running/debugging this test, or
|
|
|
1bdc94 |
tests similar to this one, to show some of the logging channels.
|
|
|
1bdc94 |
Example:
|
|
|
1bdc94 |
|
|
|
1bdc94 |
$ avocado --show=QMP,console run boot_linux_console.py
|
|
|
1bdc94 |
|
|
|
1bdc94 |
Signed-off-by: Cleber Rosa <crosa@redhat.com>
|
|
|
1bdc94 |
Message-Id: <20180530184156.15634-6-crosa@redhat.com>
|
|
|
1bdc94 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
|
|
|
1bdc94 |
(cherry picked from commit c1cc73f407b890c4e7ab5bf520c0637e0364e92a)
|
|
|
1bdc94 |
Signed-off-by: Yash Mankad <ymankad@redhat.com>
|
|
|
1bdc94 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
1bdc94 |
---
|
|
|
1bdc94 |
tests/acceptance/boot_linux_console.py | 47 ++++++++++++++++++++++++++++++++++
|
|
|
1bdc94 |
1 file changed, 47 insertions(+)
|
|
|
1bdc94 |
create mode 100644 tests/acceptance/boot_linux_console.py
|
|
|
1bdc94 |
|
|
|
1bdc94 |
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
|
|
|
1bdc94 |
new file mode 100644
|
|
|
1bdc94 |
index 0000000..98324f7
|
|
|
1bdc94 |
--- /dev/null
|
|
|
1bdc94 |
+++ b/tests/acceptance/boot_linux_console.py
|
|
|
1bdc94 |
@@ -0,0 +1,47 @@
|
|
|
1bdc94 |
+# Functional test that boots a Linux kernel and checks the console
|
|
|
1bdc94 |
+#
|
|
|
1bdc94 |
+# Copyright (c) 2018 Red Hat, Inc.
|
|
|
1bdc94 |
+#
|
|
|
1bdc94 |
+# Author:
|
|
|
1bdc94 |
+# Cleber Rosa <crosa@redhat.com>
|
|
|
1bdc94 |
+#
|
|
|
1bdc94 |
+# This work is licensed under the terms of the GNU GPL, version 2 or
|
|
|
1bdc94 |
+# later. See the COPYING file in the top-level directory.
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+import logging
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+from avocado_qemu import Test
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+class BootLinuxConsole(Test):
|
|
|
1bdc94 |
+ """
|
|
|
1bdc94 |
+ Boots a x86_64 Linux kernel and checks that the console is operational
|
|
|
1bdc94 |
+ and the kernel command line is properly passed from QEMU to the kernel
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+ :avocado: enable
|
|
|
1bdc94 |
+ :avocado: tags=x86_64
|
|
|
1bdc94 |
+ """
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+ timeout = 60
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+ def test(self):
|
|
|
1bdc94 |
+ kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
|
|
|
1bdc94 |
+ 'Everything/x86_64/os/images/pxeboot/vmlinuz')
|
|
|
1bdc94 |
+ kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
|
|
|
1bdc94 |
+ kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
|
|
|
1bdc94 |
+
|
|
|
1bdc94 |
+ self.vm.set_machine('pc')
|
|
|
1bdc94 |
+ self.vm.set_console()
|
|
|
1bdc94 |
+ kernel_command_line = 'console=ttyS0'
|
|
|
1bdc94 |
+ self.vm.add_args('-kernel', kernel_path,
|
|
|
1bdc94 |
+ '-append', kernel_command_line)
|
|
|
1bdc94 |
+ self.vm.launch()
|
|
|
1bdc94 |
+ console = self.vm.console_socket.makefile()
|
|
|
1bdc94 |
+ console_logger = logging.getLogger('console')
|
|
|
1bdc94 |
+ while True:
|
|
|
1bdc94 |
+ msg = console.readline()
|
|
|
1bdc94 |
+ console_logger.debug(msg.strip())
|
|
|
1bdc94 |
+ if 'Kernel command line: %s' % kernel_command_line in msg:
|
|
|
1bdc94 |
+ break
|
|
|
1bdc94 |
+ if 'Kernel panic - not syncing' in msg:
|
|
|
1bdc94 |
+ self.fail("Kernel panic reached")
|
|
|
1bdc94 |
--
|
|
|
1bdc94 |
1.8.3.1
|
|
|
1bdc94 |
|