1# Test class for testing the boot process of a Linux kernel 2# 3# This work is licensed under the terms of the GNU GPL, version 2 or 4# later. See the COPYING file in the top-level directory. 5 6from .testcase import QemuSystemTest 7from .cmd import wait_for_console_pattern 8 9 10class LinuxKernelTest(QemuSystemTest): 11 KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 ' 12 13 def wait_for_console_pattern(self, success_message, vm=None): 14 wait_for_console_pattern(self, success_message, 15 failure_message='Kernel panic - not syncing', 16 vm=vm) 17 18 def launch_kernel(self, kernel, initrd=None, dtb=None, console_index=0, 19 wait_for=None): 20 self.vm.set_console(console_index=console_index) 21 self.vm.add_args('-kernel', kernel) 22 if initrd: 23 self.vm.add_args('-initrd', initrd) 24 if dtb: 25 self.vm.add_args('-dtb', dtb) 26 self.vm.launch() 27 if wait_for: 28 self.wait_for_console_pattern(wait_for) 29