]> Git Repo - qemu.git/blob - tests/acceptance/boot_linux_console.py
Merge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-03-08' into staging
[qemu.git] / tests / acceptance / boot_linux_console.py
1 # Functional test that boots a Linux kernel and checks the console
2 #
3 # Copyright (c) 2018 Red Hat, Inc.
4 #
5 # Author:
6 #  Cleber Rosa <[email protected]>
7 #
8 # This work is licensed under the terms of the GNU GPL, version 2 or
9 # later.  See the COPYING file in the top-level directory.
10
11 import logging
12
13 from avocado_qemu import Test
14
15
16 class BootLinuxConsole(Test):
17     """
18     Boots a x86_64 Linux kernel and checks that the console is operational
19     and the kernel command line is properly passed from QEMU to the kernel
20
21     :avocado: tags=x86_64
22     """
23
24     timeout = 60
25
26     def test(self):
27         kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
28                       'Everything/x86_64/os/images/pxeboot/vmlinuz')
29         kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
30         kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
31
32         self.vm.set_machine('pc')
33         self.vm.set_console()
34         kernel_command_line = 'console=ttyS0'
35         self.vm.add_args('-kernel', kernel_path,
36                          '-append', kernel_command_line)
37         self.vm.launch()
38         console = self.vm.console_socket.makefile()
39         console_logger = logging.getLogger('console')
40         while True:
41             msg = console.readline()
42             console_logger.debug(msg.strip())
43             if 'Kernel command line: %s' % kernel_command_line in msg:
44                 break
45             if 'Kernel panic - not syncing' in msg:
46                 self.fail("Kernel panic reached")
This page took 0.026532 seconds and 4 git commands to generate.