monitor: Fix tracepoint crash on JSON syntax error
[qemu/armbru.git] / tests / acceptance / boot_linux_console.py
blob98324f7591299b439f7a5a931305a2c4d4228232
1 # Functional test that boots a Linux kernel and checks the console
3 # Copyright (c) 2018 Red Hat, Inc.
5 # Author:
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.
11 import logging
13 from avocado_qemu import Test
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
21 :avocado: enable
22 :avocado: tags=x86_64
23 """
25 timeout = 60
27 def test(self):
28 kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
29 'Everything/x86_64/os/images/pxeboot/vmlinuz')
30 kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
31 kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash)
33 self.vm.set_machine('pc')
34 self.vm.set_console()
35 kernel_command_line = 'console=ttyS0'
36 self.vm.add_args('-kernel', kernel_path,
37 '-append', kernel_command_line)
38 self.vm.launch()
39 console = self.vm.console_socket.makefile()
40 console_logger = logging.getLogger('console')
41 while True:
42 msg = console.readline()
43 console_logger.debug(msg.strip())
44 if 'Kernel command line: %s' % kernel_command_line in msg:
45 break
46 if 'Kernel panic - not syncing' in msg:
47 self.fail("Kernel panic reached")