1 # Functional test that boots a Linux kernel and checks the console
3 # Copyright (c) 2018 Red Hat, Inc.
6 # Cleber Rosa <crosa@redhat.com>
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.
13 from avocado_qemu
import Test
16 class BootLinuxConsole(Test
):
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
24 KERNEL_COMMON_COMMAND_LINE
= 'printk.time=0 '
26 def test_x86_64_pc(self
):
28 :avocado: tags=arch:x86_64
29 :avocado: tags=machine:pc
31 kernel_url
= ('https://download.fedoraproject.org/pub/fedora/linux/'
32 'releases/29/Everything/x86_64/os/images/pxeboot/vmlinuz')
33 kernel_hash
= '23bebd2680757891cf7adedb033532163a792495'
34 kernel_path
= self
.fetch_asset(kernel_url
, asset_hash
=kernel_hash
)
36 self
.vm
.set_machine('pc')
38 kernel_command_line
= self
.KERNEL_COMMON_COMMAND_LINE
+ 'console=ttyS0'
39 self
.vm
.add_args('-kernel', kernel_path
,
40 '-append', kernel_command_line
)
42 console
= self
.vm
.console_socket
.makefile()
43 console_logger
= logging
.getLogger('console')
45 msg
= console
.readline()
46 console_logger
.debug(msg
.strip())
47 if 'Kernel command line: %s' % kernel_command_line
in msg
:
49 if 'Kernel panic - not syncing' in msg
:
50 self
.fail("Kernel panic reached")