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 | 49 +++++++++++++++++++++++++++++-----
1 file changed, 43 insertions(+), 6 deletions(-)
diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 6af19ae3b14a..ab2200aa0e47 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -65,15 +65,26 @@ class BootLinuxConsole(Test):
os.chdir(cwd)
return self.workdir + '/' + path
- def do_test_x86_64_machine(self):
+ def do_test_x86_64_machine(self, pvh=False):
"""
:avocado: tags=arch:x86_64
"""
- 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)
+ if pvh:
+ 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')
+ rpm_hash = '4c781711a9d32dcb8e81da2b397cb98926744e23'
+ rpm_path = self.fetch_asset(rpm_url, asset_hash=rpm_hash)
+ kernel_path = self.extract_from_rpm(rpm_path,
+ './usr/share/kata-containers/'
+ 'vmlinux-4.14.35-1902.6.6.1.el7.container')
+ else:
+ 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)
+
self.vm.set_console()
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
self.vm.add_args('-kernel', kernel_path,
@@ -95,6 +106,19 @@ 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=machine:pc
+ """
+ self.do_test_x86_64_machine(pvh=True)
+
+ def test_x86_64_pc_qboot_pvh(self):
+ """
+ :avocado: tags=machine:pc
+ """
+ self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
+ self.do_test_x86_64_machine(pvh=True)
+
def test_x86_64_microvm(self):
"""
:avocado: tags=machine:microvm
@@ -108,6 +132,19 @@ class BootLinuxConsole(Test):
self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
self.do_test_x86_64_machine()
+ def test_x86_64_microvm_pvh(self):
+ """
+ :avocado: tags=machine:microvm
+ """
+ self.do_test_x86_64_machine(pvh=True)
+
+ def test_x86_64_microvm_qboot_pvh(self):
+ """
+ :avocado: tags=machine:microvm
+ """
+ self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
+ self.do_test_x86_64_machine(pvh=True)
+
def test_mips_malta(self):
"""
:avocado: tags=arch:mips
--
1.8.3.1
On Mon, Jan 27, 2020 at 04:36:34PM +0000, 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 | 49 +++++++++++++++++++++++++++++-----
> 1 file changed, 43 insertions(+), 6 deletions(-)
>
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 6af19ae3b14a..ab2200aa0e47 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -65,15 +65,26 @@ class BootLinuxConsole(Test):
> os.chdir(cwd)
> return self.workdir + '/' + path
>
> - def do_test_x86_64_machine(self):
> + def do_test_x86_64_machine(self, pvh=False):
> """
> :avocado: tags=arch:x86_64
> """
> - 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)
> + if pvh:
> + 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')
> + rpm_hash = '4c781711a9d32dcb8e81da2b397cb98926744e23'
> + rpm_path = self.fetch_asset(rpm_url, asset_hash=rpm_hash)
> + kernel_path = self.extract_from_rpm(rpm_path,
> + './usr/share/kata-containers/'
> + 'vmlinux-4.14.35-1902.6.6.1.el7.container')
> + else:
> + 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)
> +
> self.vm.set_console()
> kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
> self.vm.add_args('-kernel', kernel_path,
> @@ -95,6 +106,19 @@ 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=machine:pc
> + """
> + self.do_test_x86_64_machine(pvh=True)
> +
> + def test_x86_64_pc_qboot_pvh(self):
> + """
> + :avocado: tags=machine:pc
> + """
> + self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> + self.do_test_x86_64_machine(pvh=True)
> +
> def test_x86_64_microvm(self):
> """
> :avocado: tags=machine:microvm
> @@ -108,6 +132,19 @@ class BootLinuxConsole(Test):
> self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> self.do_test_x86_64_machine()
>
> + def test_x86_64_microvm_pvh(self):
> + """
> + :avocado: tags=machine:microvm
> + """
> + self.do_test_x86_64_machine(pvh=True)
> +
> + def test_x86_64_microvm_qboot_pvh(self):
> + """
> + :avocado: tags=machine:microvm
> + """
> + self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> + self.do_test_x86_64_machine(pvh=True)
Also in this case I think we are using qboot in both tests.
Maybe we can remove one of them.
Thanks,
Stefano
On 1/27/20 5:36 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 | 49 +++++++++++++++++++++++++++++-----
> 1 file changed, 43 insertions(+), 6 deletions(-)
>
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 6af19ae3b14a..ab2200aa0e47 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -65,15 +65,26 @@ class BootLinuxConsole(Test):
> os.chdir(cwd)
> return self.workdir + '/' + path
>
> - def do_test_x86_64_machine(self):
> + def do_test_x86_64_machine(self, pvh=False):
> """
> :avocado: tags=arch:x86_64
> """
> - 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)
> + if pvh:
> + 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')
> + rpm_hash = '4c781711a9d32dcb8e81da2b397cb98926744e23'
> + rpm_path = self.fetch_asset(rpm_url, asset_hash=rpm_hash)
> + kernel_path = self.extract_from_rpm(rpm_path,
> + './usr/share/kata-containers/'
> + 'vmlinux-4.14.35-1902.6.6.1.el7.container')
> + else:
> + 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)
> +
Can you try using a dictionaries instead? This way we can add more
images easily.
See IMAGE_INFO in tests/acceptance/linux_ssh_mips_malta.py.
> self.vm.set_console()
> kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE + 'console=ttyS0'
> self.vm.add_args('-kernel', kernel_path,
> @@ -95,6 +106,19 @@ 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=machine:pc
> + """
> + self.do_test_x86_64_machine(pvh=True)
> +
> + def test_x86_64_pc_qboot_pvh(self):
> + """
> + :avocado: tags=machine:pc
> + """
> + self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> + self.do_test_x86_64_machine(pvh=True)
> +
> def test_x86_64_microvm(self):
> """
> :avocado: tags=machine:microvm
> @@ -108,6 +132,19 @@ class BootLinuxConsole(Test):
> self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> self.do_test_x86_64_machine()
>
> + def test_x86_64_microvm_pvh(self):
> + """
> + :avocado: tags=machine:microvm
> + """
> + self.do_test_x86_64_machine(pvh=True)
> +
> + def test_x86_64_microvm_qboot_pvh(self):
> + """
> + :avocado: tags=machine:microvm
> + """
> + self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> + self.do_test_x86_64_machine(pvh=True)
> +
> def test_mips_malta(self):
> """
> :avocado: tags=arch:mips
>
On 30/01/2020 23:57, Philippe Mathieu-Daudé wrote:
> On 1/27/20 5:36 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 | 49
>> +++++++++++++++++++++++++++++-----
>> 1 file changed, 43 insertions(+), 6 deletions(-)
>>
>> diff --git a/tests/acceptance/boot_linux_console.py
>> b/tests/acceptance/boot_linux_console.py
>> index 6af19ae3b14a..ab2200aa0e47 100644
>> --- a/tests/acceptance/boot_linux_console.py
>> +++ b/tests/acceptance/boot_linux_console.py
>> @@ -65,15 +65,26 @@ class BootLinuxConsole(Test):
>> os.chdir(cwd)
>> return self.workdir + '/' + path
>> - def do_test_x86_64_machine(self):
>> + def do_test_x86_64_machine(self, pvh=False):
>> """
>> :avocado: tags=arch:x86_64
>> """
>> - 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)
>> + if pvh:
>> + 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')
>> + rpm_hash = '4c781711a9d32dcb8e81da2b397cb98926744e23'
>> + rpm_path = self.fetch_asset(rpm_url, asset_hash=rpm_hash)
>> + kernel_path = self.extract_from_rpm(rpm_path,
>> +
>> './usr/share/kata-containers/'
>> +
>> 'vmlinux-4.14.35-1902.6.6.1.el7.container')
>> + else:
>> + 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)
>> +
>
> Can you try using a dictionaries instead? This way we can add more
> images easily.
> See IMAGE_INFO in tests/acceptance/linux_ssh_mips_malta.py.
I can. I won't convert the users of extract_from_deb() but will try make
it easily extendable.
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -31,6 +31,29 @@ class BootLinuxConsole(Test):
KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
+ KERNEL_PATH_INFO = {
+ ('x86_64', 'bzImage'): {
+ 'type': 'file',
+ 'url': 'https://archives.fedoraproject.org/'
+ 'pub/archive/fedora/linux/releases/29/Everything/'
+ 'x86_64/os/images/pxeboot/vmlinuz',
+ 'hash': '23bebd2680757891cf7adedb033532163a792495'
+ }
+ }
+
+ def get_kernel_path(self, key):
+ """
+ For the provided key, download (and extract, if necessary) the
kernel
+ and return the path the the kernel binary.
+
+ :param key: index into KERNEL_PATH_INFO dict containing kernel
location
+ :returns: path of the extracted file
+ """
+ dinfo = self.KERNEL_PATH_INFO[(self.arch, key)]
+
+ if dinfo['type'] is 'file':
+ return self.fetch_asset(dinfo['url'], asset_hash=dinfo['hash'])
+
def wait_for_console_pattern(self, success_message):
wait_for_console_pattern(self, success_message,
failure_message='Kernel panic - not
syncing')
@@ -72,11 +95,7 @@ class BootLinuxConsole(Test):
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)
+ kernel_path = self.get_kernel_path('bzImage')
self.vm.set_console()
kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE +
'console=ttyS0'
self.vm.add_args('-kernel', kernel_path,
Regards,
Liam
On 1/31/20 4:03 PM, Liam Merwick wrote:
> On 30/01/2020 23:57, Philippe Mathieu-Daudé wrote:
>> On 1/27/20 5:36 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 | 49
>>> +++++++++++++++++++++++++++++-----
>>> 1 file changed, 43 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/tests/acceptance/boot_linux_console.py
>>> b/tests/acceptance/boot_linux_console.py
>>> index 6af19ae3b14a..ab2200aa0e47 100644
>>> --- a/tests/acceptance/boot_linux_console.py
>>> +++ b/tests/acceptance/boot_linux_console.py
>>> @@ -65,15 +65,26 @@ class BootLinuxConsole(Test):
>>> os.chdir(cwd)
>>> return self.workdir + '/' + path
>>> - def do_test_x86_64_machine(self):
>>> + def do_test_x86_64_machine(self, pvh=False):
>>> """
>>> :avocado: tags=arch:x86_64
>>> """
>>> - 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)
>>> + if pvh:
>>> + 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')
>>> + rpm_hash = '4c781711a9d32dcb8e81da2b397cb98926744e23'
>>> + rpm_path = self.fetch_asset(rpm_url, asset_hash=rpm_hash)
>>> + kernel_path = self.extract_from_rpm(rpm_path,
>>> + './usr/share/kata-containers/'
>>> + 'vmlinux-4.14.35-1902.6.6.1.el7.container')
>>> + else:
>>> + 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)
>>> +
>>
>> Can you try using a dictionaries instead? This way we can add more
>> images easily.
>> See IMAGE_INFO in tests/acceptance/linux_ssh_mips_malta.py.
>
> I can. I won't convert the users of extract_from_deb() but will try make
> it easily extendable.
>
>
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -31,6 +31,29 @@ class BootLinuxConsole(Test):
>
> KERNEL_COMMON_COMMAND_LINE = 'printk.time=0 '
>
> + KERNEL_PATH_INFO = {
> + ('x86_64', 'bzImage'): {
> + 'type': 'file',
> + 'url': 'https://archives.fedoraproject.org/'
> + 'pub/archive/fedora/linux/releases/29/Everything/'
> + 'x86_64/os/images/pxeboot/vmlinuz',
> + 'hash': '23bebd2680757891cf7adedb033532163a792495'
> + }
> + }
I was thinking of something simpler, adding the dictionary local to
do_test_x86_64_machine().
def do_test_x86_64_machine(self, test_type):
d = {
'pvh_disabled': {
'url': 'https://archives.fedoraproject.org/'
'pub/archive/fedora/linux/releases/29/Everything/'
'x86_64/os/images/pxeboot/vmlinuz',
'hash': '23bebd2680757891cf7adedb033532163a792495'
},
'pvh_enabled': {...}
}
...
def test_x86_64_pc_pvh(self):
"""
:avocado: tags=machine:pc
"""
self.do_test_x86_64_machine('pvh_enabled')
> +
> + def get_kernel_path(self, key):
> + """
> + For the provided key, download (and extract, if necessary) the
> kernel
> + and return the path the the kernel binary.
> +
> + :param key: index into KERNEL_PATH_INFO dict containing kernel
> location
> + :returns: path of the extracted file
> + """
> + dinfo = self.KERNEL_PATH_INFO[(self.arch, key)]
> +
> + if dinfo['type'] is 'file':
> + return self.fetch_asset(dinfo['url'],
> asset_hash=dinfo['hash'])
> +
> def wait_for_console_pattern(self, success_message):
> wait_for_console_pattern(self, success_message,
> failure_message='Kernel panic - not
> syncing')
> @@ -72,11 +95,7 @@ class BootLinuxConsole(Test):
> 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)
> + kernel_path = self.get_kernel_path('bzImage')
> self.vm.set_console()
> kernel_command_line = self.KERNEL_COMMON_COMMAND_LINE +
> 'console=ttyS0'
> self.vm.add_args('-kernel', kernel_path,
>
>
> Regards,
> Liam
>
>
© 2016 - 2026 Red Hat, Inc.