Message ID | 1580914565-19675-6-git-send-email-liam.merwick@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | tests/boot_linux_console: add extra boot acceptance tests | expand |
On 2/5/20 3:56 PM, Liam Merwick wrote: > Add tests to boot an uncompressed kernel using the x86/HVM direct boot ABI. > The vmlinux binary is obtained from a small RPM for Kata containers and > extracted using the new extract_from_rpm() method. > > Signed-off-by: Liam Merwick <liam.merwick@oracle.com> > --- > tests/acceptance/boot_linux_console.py | 60 ++++++++++++++++++++++++++++++---- > 1 file changed, 53 insertions(+), 7 deletions(-) > > diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py > index 6a473363a122..9c55218cb5bb 100644 > --- a/tests/acceptance/boot_linux_console.py > +++ b/tests/acceptance/boot_linux_console.py > @@ -67,16 +67,40 @@ class BootLinuxConsole(Test): > os.chdir(cwd) > return os.path.normpath(os.path.join(self.workdir, path)) > > - def do_test_x86_64_machine(self): > + def do_test_x86_64_machine(self, kernel_type='bzImage'): > """ > Common routine to boot an x86_64 guest. > Caller must specify tags=arch and tags=machine > - """ > - kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' > - '/linux/releases/29/Everything/x86_64/os/images/pxeboot' > - '/vmlinuz') > - kernel_hash = '23bebd2680757891cf7adedb033532163a792495' > - kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) > + :param kernel: specify kernel type to be downloaded and booted: > + compressed = 'bzImage', uncompressed = 'vmlinux' > + """ > + > + KERNEL_PATH_INFO = { > + 'bzImage': { > + 'type': 'file', > + 'url': 'https://archives.fedoraproject.org/' > + 'pub/archive/fedora/linux/releases/29/Everything/' > + 'x86_64/os/images/pxeboot/vmlinuz', > + 'hash': '23bebd2680757891cf7adedb033532163a792495' > + }, > + 'vmlinux': { > + 'type': 'rpm', > + 'url': 'https://yum.oracle.com/' > + 'repo/OracleLinux/OL7/olcne/x86_64/getPackage/' > + 'kernel-uek-container-4.14.35-1902.6.6.1.el7.x86_64.rpm', > + 'file': './usr/share/kata-containers/' > + 'vmlinux-4.14.35-1902.6.6.1.el7.container', > + 'hash': '4c781711a9d32dcb8e81da2b397cb98926744e23' > + } > + } > + > + k = KERNEL_PATH_INFO[kernel_type] > + if k['type'] is 'file': > + kernel_path = self.fetch_asset(k['url'], asset_hash=k['hash']) > + else: > + assert k['type'] is 'rpm' > + rpm_path = self.fetch_asset(k['url'], asset_hash=k['hash']) > + kernel_path = self.extract_from_rpm(rpm_path, k['file']) > self.vm.set_console() > kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' > self.vm.add_args('-kernel', kernel_path, > @@ -100,6 +124,21 @@ class BootLinuxConsole(Test): > self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin') > self.do_test_x86_64_machine() > > + def test_x86_64_pc_pvh(self): > + """ > + :avocado: tags=arch:x86_64 > + :avocado: tags=machine:pc > + """ > + self.do_test_x86_64_machine(kernel_type='vmlinux') This test doesn't pass with my distrib QEMU, it gets killed after using 100% of a core during 1min30: (3/7) tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc_pvh: INTERRUPTED: Test interrupted by SIGTERM (90.32 s) I see PVH was introduced in QEMU v4.2, so with these patches: https://www.mail-archive.com/qemu-devel@nongnu.org/msg675077.html https://www.mail-archive.com/qemu-devel@nongnu.org/msg675075.html You could use: :avocado: tags=version-min:4.2 Do you mind reviewing them? > + > + def test_x86_64_pc_qboot_pvh(self): > + """ > + :avocado: tags=arch:x86_64 > + :avocado: tags=machine:pc > + """ > + self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin') > + self.do_test_x86_64_machine(kernel_type='vmlinux') > + > def test_x86_64_microvm(self): > """ > :avocado: tags=arch:x86_64 > @@ -115,6 +154,13 @@ class BootLinuxConsole(Test): > self.vm.add_args('-bios', 'pc-bios/bios.bin') > self.do_test_x86_64_machine() > > + def test_x86_64_microvm_pvh(self): > + """ > + :avocado: tags=arch:x86_64 > + :avocado: tags=machine:microvm > + """ > + self.do_test_x86_64_machine(kernel_type='vmlinux') > + > def test_mips_malta(self): > """ > :avocado: tags=arch:mips >
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py index 6a473363a122..9c55218cb5bb 100644 --- a/tests/acceptance/boot_linux_console.py +++ b/tests/acceptance/boot_linux_console.py @@ -67,16 +67,40 @@ class BootLinuxConsole(Test): os.chdir(cwd) return os.path.normpath(os.path.join(self.workdir, path)) - def do_test_x86_64_machine(self): + def do_test_x86_64_machine(self, kernel_type='bzImage'): """ Common routine to boot an x86_64 guest. Caller must specify tags=arch and tags=machine - """ - kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora' - '/linux/releases/29/Everything/x86_64/os/images/pxeboot' - '/vmlinuz') - kernel_hash = '23bebd2680757891cf7adedb033532163a792495' - kernel_path = self.fetch_asset(kernel_url, asset_hash=kernel_hash) + :param kernel: specify kernel type to be downloaded and booted: + compressed = 'bzImage', uncompressed = 'vmlinux' + """ + + KERNEL_PATH_INFO = { + 'bzImage': { + 'type': 'file', + 'url': 'https://archives.fedoraproject.org/' + 'pub/archive/fedora/linux/releases/29/Everything/' + 'x86_64/os/images/pxeboot/vmlinuz', + 'hash': '23bebd2680757891cf7adedb033532163a792495' + }, + 'vmlinux': { + 'type': 'rpm', + 'url': 'https://yum.oracle.com/' + 'repo/OracleLinux/OL7/olcne/x86_64/getPackage/' + 'kernel-uek-container-4.14.35-1902.6.6.1.el7.x86_64.rpm', + 'file': './usr/share/kata-containers/' + 'vmlinux-4.14.35-1902.6.6.1.el7.container', + 'hash': '4c781711a9d32dcb8e81da2b397cb98926744e23' + } + } + + k = KERNEL_PATH_INFO[kernel_type] + if k['type'] is 'file': + kernel_path = self.fetch_asset(k['url'], asset_hash=k['hash']) + else: + assert k['type'] is 'rpm' + rpm_path = self.fetch_asset(k['url'], asset_hash=k['hash']) + kernel_path = self.extract_from_rpm(rpm_path, k['file']) self.vm.set_console() kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0' self.vm.add_args('-kernel', kernel_path, @@ -100,6 +124,21 @@ class BootLinuxConsole(Test): self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin') self.do_test_x86_64_machine() + def test_x86_64_pc_pvh(self): + """ + :avocado: tags=arch:x86_64 + :avocado: tags=machine:pc + """ + self.do_test_x86_64_machine(kernel_type='vmlinux') + + def test_x86_64_pc_qboot_pvh(self): + """ + :avocado: tags=arch:x86_64 + :avocado: tags=machine:pc + """ + self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin') + self.do_test_x86_64_machine(kernel_type='vmlinux') + def test_x86_64_microvm(self): """ :avocado: tags=arch:x86_64 @@ -115,6 +154,13 @@ class BootLinuxConsole(Test): self.vm.add_args('-bios', 'pc-bios/bios.bin') self.do_test_x86_64_machine() + def test_x86_64_microvm_pvh(self): + """ + :avocado: tags=arch:x86_64 + :avocado: tags=machine:microvm + """ + self.do_test_x86_64_machine(kernel_type='vmlinux') + def test_mips_malta(self): """ :avocado: tags=arch:mips
Add tests to boot an uncompressed kernel using the x86/HVM direct boot ABI. The vmlinux binary is obtained from a small RPM for Kata containers and extracted using the new extract_from_rpm() method. Signed-off-by: Liam Merwick <liam.merwick@oracle.com> --- tests/acceptance/boot_linux_console.py | 60 ++++++++++++++++++++++++++++++---- 1 file changed, 53 insertions(+), 7 deletions(-)