qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Liam Merwick <liam.merwick@oracle.com>
To: "Philippe Mathieu-Daudé" <philmd@redhat.com>,
	alex.bennee@linaro.org, fam@euphon.net
Cc: slp@redhat.com, qemu-devel@nongnu.org, wainersm@redhat.com,
	pbonzini@redhat.com, sgarzare@redhat.com
Subject: Re: [PATCH 6/6] tests/boot_linux_console: add PVH acceptance tests
Date: Fri, 31 Jan 2020 15:03:06 +0000	[thread overview]
Message-ID: <8bf4b25b-0e1b-1d7a-d166-e7b746dba207@oracle.com> (raw)
In-Reply-To: <33e03e74-e579-c0e8-e1fc-bd408aeb32e8@redhat.com>

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



  reply	other threads:[~2020-01-31 15:04 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-27 16:36 [PATCH 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
2020-01-27 16:36 ` [PATCH 1/6] tests/boot_linux_console: add microvm acceptance test Liam Merwick
2020-01-30 11:49   ` Stefano Garzarella
2020-01-30 17:41   ` Wainer dos Santos Moschetta
2020-01-30 23:51     ` Philippe Mathieu-Daudé
2020-01-31 18:10       ` Wainer dos Santos Moschetta
2020-01-27 16:36 ` [PATCH 2/6] tests/boot_linux_console: add BIOS " Liam Merwick
2020-01-30 11:27   ` Stefano Garzarella
2020-01-30 15:34     ` Liam Merwick
2020-01-30 16:28       ` Liam Merwick
2020-01-30 16:45         ` Stefano Garzarella
2020-01-27 16:36 ` [PATCH 3/6] tests/boot_linux_console: fix extract_from_deb() comment Liam Merwick
2020-01-30 11:29   ` Stefano Garzarella
2020-01-30 18:17   ` Wainer dos Santos Moschetta
2020-01-31  0:03   ` Philippe Mathieu-Daudé
2020-01-27 16:36 ` [PATCH 4/6] travis.yml: install rpm2cpio for acceptance tests Liam Merwick
2020-01-30 12:00   ` Stefano Garzarella
2020-01-27 16:36 ` [PATCH 5/6] tests/boot_linux_console: add extract_from_rpm method Liam Merwick
2020-01-30 12:05   ` Stefano Garzarella
2020-01-30 15:34     ` Liam Merwick
2020-01-30 19:19       ` Wainer dos Santos Moschetta
2020-01-30 23:59         ` Philippe Mathieu-Daudé
2020-01-31 15:02         ` Liam Merwick
2020-02-04 13:31           ` Liam Merwick
2020-02-04 14:22             ` Philippe Mathieu-Daudé
2020-01-27 16:36 ` [PATCH 6/6] tests/boot_linux_console: add PVH acceptance tests Liam Merwick
2020-01-30 12:08   ` Stefano Garzarella
2020-01-30 23:57   ` Philippe Mathieu-Daudé
2020-01-31 15:03     ` Liam Merwick [this message]
2020-01-31 15:18       ` Philippe Mathieu-Daudé
2020-01-30 17:57 ` [PATCH 0/6] tests/boot_linux_console: add extra boot " Wainer dos Santos Moschetta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8bf4b25b-0e1b-1d7a-d166-e7b746dba207@oracle.com \
    --to=liam.merwick@oracle.com \
    --cc=alex.bennee@linaro.org \
    --cc=fam@euphon.net \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=sgarzare@redhat.com \
    --cc=slp@redhat.com \
    --cc=wainersm@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).