tests/functional/qemu_test: Add a function for launching kernels more easily

The task for launching a kernel is quite repetitive: Set the serial
console, set the -kernel and maybe -initrd and -dtb parameters,
launch the VM and then wait for the expected console output. So
it's easier in some tests to provide these steps via a separate
function.

Message-ID: <20240919185749.71222-2-thuth@redhat.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Thomas Huth 2024-09-19 20:57:41 +02:00
parent 01dc65a3bc
commit d2a500cea9
1 changed files with 12 additions and 0 deletions

View File

@ -17,6 +17,18 @@ class LinuxKernelTest(QemuSystemTest):
failure_message='Kernel panic - not syncing',
vm=vm)
def launch_kernel(self, kernel, initrd=None, dtb=None, console_index=0,
wait_for=None):
self.vm.set_console(console_index=console_index)
self.vm.add_args('-kernel', kernel)
if initrd:
self.vm.add_args('-initrd', initrd)
if dtb:
self.vm.add_args('-dtb', dtb)
self.vm.launch()
if wait_for:
self.wait_for_console_pattern(wait_for)
def extract_from_deb(self, deb_path, path):
"""
Extracts a file from a deb package into the test workdir