]> git.proxmox.com Git - mirror_qemu.git/blame - tests/acceptance/boot_linux_console.py
tests/boot_linux_console: rename the x86_64 after the arch and machine
[mirror_qemu.git] / tests / acceptance / boot_linux_console.py
CommitLineData
c1cc73f4
CR
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 <crosa@redhat.com>
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
11import logging
12
13from avocado_qemu import Test
14
15
16class BootLinuxConsole(Test):
17 """
78664ed8
CR
18 Boots a Linux kernel and checks that the console is operational and the
19 kernel command line is properly passed from QEMU to the kernel
c1cc73f4
CR
20 """
21
22 timeout = 60
23
78664ed8
CR
24 def test_x86_64_pc(self):
25 """
26 :avocado: tags=arch:x86_64
27 :avocado: tags=machine:pc
28 """
c1cc73f4
CR
29 kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
30 'Everything/x86_64/os/images/pxeboot/vmlinuz')
31 kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
32 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
33
34 self.vm.set_machine('pc')
35 self.vm.set_console()
36 kernel_command_line = 'console=ttyS0'
37 self.vm.add_args('-kernel', kernel_path,
38 '-append', kernel_command_line)
39 self.vm.launch()
40 console = self.vm.console_socket.makefile()
41 console_logger = logging.getLogger('console')
42 while True:
43 msg = console.readline()
44 console_logger.debug(msg.strip())
45 if 'Kernel command line: %s' % kernel_command_line in msg:
46 break
47 if 'Kernel panic - not syncing' in msg:
48 self.fail("Kernel panic reached")