All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests
@ 2020-02-05 14:55 Liam Merwick
  2020-02-05 14:56 ` [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test Liam Merwick
                   ` (6 more replies)
  0 siblings, 7 replies; 19+ messages in thread
From: Liam Merwick @ 2020-02-05 14:55 UTC (permalink / raw)
  To: alex.bennee, fam, philmd; +Cc: slp, qemu-devel, wainersm, pbonzini, sgarzare

Add acceptance tests for the microvm machine class, PVH, and the
new qboot BIOS.

In the case of the test to boot an uncompressed kernel there didn't
seem to be any suitable uncompressed kernel on https://archives.fedoraproject.org/
(there is a vmlinux in kernel-debuginfo but that RPM is 575M and
caused timeouts when populating the Avocado cache when first run)
so I chose an RPM with kernels for Kata that is 14M.
(there was a discussion in [1] regarding testing PVH boot but it focussed
more around building a vmlinux binary during testing).

[ What prompted these patches was the discovery that a 'pc' guest booting an
uncompressed kernel (PVH) with a PCI netdev hangs (before we even get guest
console output) when bios-microvm.bin (qboot) is supplied via -bios
(no issue when using 'q35' or 'microvm' machine classes).

E.g. adding the following line to test_x86_64_pc_qboot_pvh() is enough to
trigger a guest hang during startup:
self.vm.add_args('-netdev', 'user,id=n1', '-device', 'virtio-net-pci,netdev=n1')

I bisected that issue to 176d2cda0dee [2] in 4.1 but haven't worked out yet
how/why the "die-id" changes impact the qboot/PVH combination
(the boot succeeds with any subset of those boot variables).

Is booting the 'pc' machine class with bios-microvm.bin something that QEMU
officially supports or is qboot intended for microvm only? ]

Each test added here adds about 1.5s to the overall runtime.
I have run them through the Travis QEMU CI [3] and those acceptance tests pass.

v1 -> v2
Removed unnecessary qboot test for microvm in Patches 2 and 5 [Stefano]
Added SeaBIOS test for microvm to Patch2
Fix path concatenation in Patch4 to use os.path for filesystem paths [Wanier]
Added Patch6 to fix extract_from_deb() to use os.path for filesystem paths
Used dictionary to store kernel info in Patch5 [Philippe]
Dropped patch with typo fix that has been queued separately
Added Stefano's R-b to the patches which have not significantly changed.

[1] https://patchew.org/QEMU/20191206140012.15517-1-wainersm@redhat.com/
[2] 176d2cda0dee ("i386/cpu: Consolidate die-id validity in smp context")
[3] https://travis-ci.org/merwick/qemu/builds/645487393
[4] https://github.com/wainersm/qemu/commit/8f705e98df90b436b0f4946331d441309c437f7b


Liam Merwick (6):
  tests/boot_linux_console: add microvm acceptance test
  tests/boot_linux_console: add BIOS acceptance test
  travis.yml: install rpm2cpio for acceptance tests
  tests/boot_linux_console: add extract_from_rpm method
  tests/boot_linux_console: add PVH acceptance tests
  tests/boot_linux_console: use os.path for filesystem paths

 .travis.yml                            |   1 +
 tests/acceptance/boot_linux_console.py | 114 ++++++++++++++++++++++++++++++---
 2 files changed, 106 insertions(+), 9 deletions(-)

-- 
1.8.3.1



^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test
  2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
@ 2020-02-05 14:56 ` Liam Merwick
  2020-02-06 13:57   ` Philippe Mathieu-Daudé
  2020-02-05 14:56 ` [PATCH v2 2/6] tests/boot_linux_console: add BIOS " Liam Merwick
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Liam Merwick @ 2020-02-05 14:56 UTC (permalink / raw)
  To: alex.bennee, fam, philmd; +Cc: slp, qemu-devel, wainersm, pbonzini, sgarzare

Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
functions which specify the Avocado tag of ':avocado: tags=machine:'
as being either 'pc' or 'microvm' can be used to test booting a
compressed kernel using either machine class.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index e40b84651b0b..233601b429bd 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
         os.chdir(cwd)
         return self.workdir + path
 
-    def test_x86_64_pc(self):
+    def do_test_x86_64_machine(self):
         """
-        :avocado: tags=arch:x86_64
-        :avocado: tags=machine:pc
+        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'
@@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_x86_64_pc(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:pc
+        """
+        self.do_test_x86_64_machine()
+
+    def test_x86_64_microvm(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:microvm
+        """
+        self.do_test_x86_64_machine()
+
     def test_mips_malta(self):
         """
         :avocado: tags=arch:mips
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 2/6] tests/boot_linux_console: add BIOS acceptance test
  2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
  2020-02-05 14:56 ` [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test Liam Merwick
@ 2020-02-05 14:56 ` Liam Merwick
  2020-02-06 14:12   ` Philippe Mathieu-Daudé
  2020-02-05 14:56 ` [PATCH v2 3/6] travis.yml: install rpm2cpio for acceptance tests Liam Merwick
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Liam Merwick @ 2020-02-05 14:56 UTC (permalink / raw)
  To: alex.bennee, fam, philmd; +Cc: slp, qemu-devel, wainersm, pbonzini, sgarzare

Add a test to use qboot with the 'pc' machine class and SeaBIOS with
the 'microvm' machine class (since microvm uses qboot by default) by
adding the '-bios' option via self.vm.add_args() before
calling do_test_x86_64_machine().

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 233601b429bd..e9375590bc1c 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -61,7 +61,6 @@ class BootLinuxConsole(Test):
                       '/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,
@@ -77,6 +76,14 @@ class BootLinuxConsole(Test):
         """
         self.do_test_x86_64_machine()
 
+    def test_x86_64_pc_qboot(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()
+
     def test_x86_64_microvm(self):
         """
         :avocado: tags=arch:x86_64
@@ -84,6 +91,14 @@ class BootLinuxConsole(Test):
         """
         self.do_test_x86_64_machine()
 
+    def test_x86_64_microvm_seabios(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:microvm
+        """
+        self.vm.add_args('-bios', 'pc-bios/bios.bin')
+        self.do_test_x86_64_machine()
+
     def test_mips_malta(self):
         """
         :avocado: tags=arch:mips
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 3/6] travis.yml: install rpm2cpio for acceptance tests
  2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
  2020-02-05 14:56 ` [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test Liam Merwick
  2020-02-05 14:56 ` [PATCH v2 2/6] tests/boot_linux_console: add BIOS " Liam Merwick
@ 2020-02-05 14:56 ` Liam Merwick
  2020-02-06 14:27   ` Philippe Mathieu-Daudé
  2020-02-05 14:56 ` [PATCH v2 4/6] tests/boot_linux_console: add extract_from_rpm method Liam Merwick
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Liam Merwick @ 2020-02-05 14:56 UTC (permalink / raw)
  To: alex.bennee, fam, philmd; +Cc: slp, qemu-devel, wainersm, pbonzini, sgarzare

The extract_from_rpm() method added for the PVH acceptance tests needs
rpm2cpio to extract a vmlinux binary from an RPM.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
 .travis.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis.yml b/.travis.yml
index 3b35b7cf04d3..59773365823e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -323,6 +323,7 @@ matrix:
             - python3-pil
             - python3-pip
             - python3.5-venv
+            - rpm2cpio
             - tesseract-ocr
             - tesseract-ocr-eng
 
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 4/6] tests/boot_linux_console: add extract_from_rpm method
  2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
                   ` (2 preceding siblings ...)
  2020-02-05 14:56 ` [PATCH v2 3/6] travis.yml: install rpm2cpio for acceptance tests Liam Merwick
@ 2020-02-05 14:56 ` Liam Merwick
  2020-02-06 14:27   ` Philippe Mathieu-Daudé
  2020-02-05 14:56 ` [PATCH v2 5/6] tests/boot_linux_console: add PVH acceptance tests Liam Merwick
                   ` (2 subsequent siblings)
  6 siblings, 1 reply; 19+ messages in thread
From: Liam Merwick @ 2020-02-05 14:56 UTC (permalink / raw)
  To: alex.bennee, fam, philmd; +Cc: slp, qemu-devel, wainersm, pbonzini, sgarzare

Add a method to extract a specified file from an RPM to the test's
working directory and return the path to the extracted file.

Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index e9375590bc1c..6a473363a122 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -51,6 +51,22 @@ class BootLinuxConsole(Test):
         os.chdir(cwd)
         return self.workdir + path
 
+    def extract_from_rpm(self, rpm, path):
+        """
+        Extracts a file from an RPM package into the test workdir.
+
+        :param rpm: path to the rpm archive
+        :param path: path within the rpm archive of the file to be extracted
+                     needs to be a relative path (starting with './') because
+                     cpio(1), which is used to extract the file, expects that.
+        :returns: path of the extracted file
+        """
+        cwd = os.getcwd()
+        os.chdir(self.workdir)
+        process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True)
+        os.chdir(cwd)
+        return os.path.normpath(os.path.join(self.workdir, path))
+
     def do_test_x86_64_machine(self):
         """
         Common routine to boot an x86_64 guest.
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 5/6] tests/boot_linux_console: add PVH acceptance tests
  2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
                   ` (3 preceding siblings ...)
  2020-02-05 14:56 ` [PATCH v2 4/6] tests/boot_linux_console: add extract_from_rpm method Liam Merwick
@ 2020-02-05 14:56 ` Liam Merwick
  2020-02-06 14:24   ` Philippe Mathieu-Daudé
  2020-02-05 14:56 ` [PATCH v2 6/6] tests/boot_linux_console: use os.path for filesystem paths Liam Merwick
  2020-02-06 15:24 ` [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Philippe Mathieu-Daudé
  6 siblings, 1 reply; 19+ messages in thread
From: Liam Merwick @ 2020-02-05 14:56 UTC (permalink / raw)
  To: alex.bennee, fam, philmd; +Cc: slp, qemu-devel, wainersm, pbonzini, sgarzare

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')
+
+    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
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH v2 6/6] tests/boot_linux_console: use os.path for filesystem paths
  2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
                   ` (4 preceding siblings ...)
  2020-02-05 14:56 ` [PATCH v2 5/6] tests/boot_linux_console: add PVH acceptance tests Liam Merwick
@ 2020-02-05 14:56 ` Liam Merwick
  2020-02-06 14:26   ` Philippe Mathieu-Daudé
  2020-02-06 15:24 ` [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Philippe Mathieu-Daudé
  6 siblings, 1 reply; 19+ messages in thread
From: Liam Merwick @ 2020-02-05 14:56 UTC (permalink / raw)
  To: alex.bennee, fam, philmd; +Cc: slp, qemu-devel, wainersm, pbonzini, sgarzare

Change extract_from_deb() to use os.path routines to manipulate the
filesystem path returned when extracting a file.

Suggested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
---
 tests/acceptance/boot_linux_console.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 9c55218cb5bb..434608f12027 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -49,7 +49,12 @@ class BootLinuxConsole(Test):
         process.run("ar x %s %s" % (deb, file_path))
         archive.extract(file_path, self.workdir)
         os.chdir(cwd)
-        return self.workdir + path
+        # Return complete path to extracted file.  Because callers to
+        # extract_from_deb() specify 'path' with a leading slash, it is
+        # necessary to use os.path.relpath() as otherwise os.path.join()
+        # interprets it as an absolute path and drops the self.workdir part.
+        return os.path.normpath(os.path.join(self.workdir,
+                                             os.path.relpath(path, '/')))
 
     def extract_from_rpm(self, rpm, path):
         """
-- 
1.8.3.1



^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test
  2020-02-05 14:56 ` [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test Liam Merwick
@ 2020-02-06 13:57   ` Philippe Mathieu-Daudé
  2020-02-06 14:09     ` Philippe Mathieu-Daudé
  0 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 13:57 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

On 2/5/20 3:56 PM, Liam Merwick wrote:
> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
> functions which specify the Avocado tag of ':avocado: tags=machine:'
> as being either 'pc' or 'microvm' can be used to test booting a
> compressed kernel using either machine class.
> 
> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>   1 file changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index e40b84651b0b..233601b429bd 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>           os.chdir(cwd)
>           return self.workdir + path
>   
> -    def test_x86_64_pc(self):
> +    def do_test_x86_64_machine(self):
>           """
> -        :avocado: tags=arch:x86_64
> -        :avocado: tags=machine:pc
> +        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'
> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>           console_pattern = 'Kernel command line: %s' % kernel_command_line
>           self.wait_for_console_pattern(console_pattern)
>   
> +    def test_x86_64_pc(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:pc
> +        """
> +        self.do_test_x86_64_machine()
> +
> +    def test_x86_64_microvm(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:microvm
> +        """
> +        self.do_test_x86_64_machine()
> +
>       def test_mips_malta(self):
>           """
>           :avocado: tags=arch:mips
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test
  2020-02-06 13:57   ` Philippe Mathieu-Daudé
@ 2020-02-06 14:09     ` Philippe Mathieu-Daudé
  2020-02-06 15:05       ` Liam Merwick
  0 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 14:09 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

Hi Liam,

On 2/6/20 2:57 PM, Philippe Mathieu-Daudé wrote:
> On 2/5/20 3:56 PM, Liam Merwick wrote:
>> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
>> functions which specify the Avocado tag of ':avocado: tags=machine:'
>> as being either 'pc' or 'microvm' can be used to test booting a
>> compressed kernel using either machine class.
>>
>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>> ---
>>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>>   1 file changed, 17 insertions(+), 3 deletions(-)
>>
>> diff --git a/tests/acceptance/boot_linux_console.py 
>> b/tests/acceptance/boot_linux_console.py
>> index e40b84651b0b..233601b429bd 100644
>> --- a/tests/acceptance/boot_linux_console.py
>> +++ b/tests/acceptance/boot_linux_console.py
>> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>>           os.chdir(cwd)
>>           return self.workdir + path
>> -    def test_x86_64_pc(self):
>> +    def do_test_x86_64_machine(self):
>>           """
>> -        :avocado: tags=arch:x86_64
>> -        :avocado: tags=machine:pc
>> +        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'
>> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>>           console_pattern = 'Kernel command line: %s' % 
>> kernel_command_line
>>           self.wait_for_console_pattern(console_pattern)
>> +    def test_x86_64_pc(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:pc
>> +        """
>> +        self.do_test_x86_64_machine()
>> +
>> +    def test_x86_64_microvm(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:microvm
>> +        """
>> +        self.do_test_x86_64_machine()
>> +
>>       def test_mips_malta(self):
>>           """
>>           :avocado: tags=arch:mips
>>
> 
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Actually this breaks testing the distrib QEMU:

  (1/2) 
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: 
PASS (2.58 s)
  (2/2) 
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_microvm:
Output: 'qemu-system-x86_64: -machine microvm: unsupported machine 
type\nUse -machine help to list supported machines\n'
ERROR: timed out (15.10 s)

Do you mind testing the series testing a machine is available?
https://www.mail-archive.com/qemu-devel@nongnu.org/msg675086.html



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/6] tests/boot_linux_console: add BIOS acceptance test
  2020-02-05 14:56 ` [PATCH v2 2/6] tests/boot_linux_console: add BIOS " Liam Merwick
@ 2020-02-06 14:12   ` Philippe Mathieu-Daudé
  2020-02-19 19:20     ` Wainer dos Santos Moschetta
  0 siblings, 1 reply; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 14:12 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam, wainersm, Cleber Rosa
  Cc: pbonzini, qemu-devel, slp, sgarzare

On 2/5/20 3:56 PM, Liam Merwick wrote:
> Add a test to use qboot with the 'pc' machine class and SeaBIOS with
> the 'microvm' machine class (since microvm uses qboot by default) by
> adding the '-bios' option via self.vm.add_args() before
> calling do_test_x86_64_machine().
> 
> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>   tests/acceptance/boot_linux_console.py | 17 ++++++++++++++++-
>   1 file changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 233601b429bd..e9375590bc1c 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -61,7 +61,6 @@ class BootLinuxConsole(Test):
>                         '/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,
> @@ -77,6 +76,14 @@ class BootLinuxConsole(Test):
>           """
>           self.do_test_x86_64_machine()
>   
> +    def test_x86_64_pc_qboot(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:pc
> +        """
> +        self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')

This breaks running once QEMU is installed:

  (2/4) 
tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc_qboot:
qemu: could not load PC BIOS 'pc-bios/bios-microvm.bin'
ERROR: [Errno 104] Connection reset by peer (0.08 s)

Cleber, Wainer, what path should we use?

> +        self.do_test_x86_64_machine()
> +
>       def test_x86_64_microvm(self):
>           """
>           :avocado: tags=arch:x86_64
> @@ -84,6 +91,14 @@ class BootLinuxConsole(Test):
>           """
>           self.do_test_x86_64_machine()
>   
> +    def test_x86_64_microvm_seabios(self):
> +        """
> +        :avocado: tags=arch:x86_64
> +        :avocado: tags=machine:microvm
> +        """
> +        self.vm.add_args('-bios', 'pc-bios/bios.bin')
> +        self.do_test_x86_64_machine()
> +
>       def test_mips_malta(self):
>           """
>           :avocado: tags=arch:mips
> 



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 5/6] tests/boot_linux_console: add PVH acceptance tests
  2020-02-05 14:56 ` [PATCH v2 5/6] tests/boot_linux_console: add PVH acceptance tests Liam Merwick
@ 2020-02-06 14:24   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 14:24 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

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
> 



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 6/6] tests/boot_linux_console: use os.path for filesystem paths
  2020-02-05 14:56 ` [PATCH v2 6/6] tests/boot_linux_console: use os.path for filesystem paths Liam Merwick
@ 2020-02-06 14:26   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 14:26 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

On 2/5/20 3:56 PM, Liam Merwick wrote:
> Change extract_from_deb() to use os.path routines to manipulate the
> filesystem path returned when extracting a file.
> 
> Suggested-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
> ---
>   tests/acceptance/boot_linux_console.py | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index 9c55218cb5bb..434608f12027 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -49,7 +49,12 @@ class BootLinuxConsole(Test):
>           process.run("ar x %s %s" % (deb, file_path))
>           archive.extract(file_path, self.workdir)
>           os.chdir(cwd)
> -        return self.workdir + path
> +        # Return complete path to extracted file.  Because callers to
> +        # extract_from_deb() specify 'path' with a leading slash, it is
> +        # necessary to use os.path.relpath() as otherwise os.path.join()
> +        # interprets it as an absolute path and drops the self.workdir part.
> +        return os.path.normpath(os.path.join(self.workdir,
> +                                             os.path.relpath(path, '/')))
>   
>       def extract_from_rpm(self, rpm, path):
>           """
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 4/6] tests/boot_linux_console: add extract_from_rpm method
  2020-02-05 14:56 ` [PATCH v2 4/6] tests/boot_linux_console: add extract_from_rpm method Liam Merwick
@ 2020-02-06 14:27   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 14:27 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

On 2/5/20 3:56 PM, Liam Merwick wrote:
> Add a method to extract a specified file from an RPM to the test's
> working directory and return the path to the extracted file.
> 
> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>   tests/acceptance/boot_linux_console.py | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
> 
> diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
> index e9375590bc1c..6a473363a122 100644
> --- a/tests/acceptance/boot_linux_console.py
> +++ b/tests/acceptance/boot_linux_console.py
> @@ -51,6 +51,22 @@ class BootLinuxConsole(Test):
>           os.chdir(cwd)
>           return self.workdir + path
>   
> +    def extract_from_rpm(self, rpm, path):
> +        """
> +        Extracts a file from an RPM package into the test workdir.
> +
> +        :param rpm: path to the rpm archive
> +        :param path: path within the rpm archive of the file to be extracted
> +                     needs to be a relative path (starting with './') because
> +                     cpio(1), which is used to extract the file, expects that.
> +        :returns: path of the extracted file
> +        """
> +        cwd = os.getcwd()
> +        os.chdir(self.workdir)
> +        process.run("rpm2cpio %s | cpio -id %s" % (rpm, path), shell=True)
> +        os.chdir(cwd)
> +        return os.path.normpath(os.path.join(self.workdir, path))
> +
>       def do_test_x86_64_machine(self):
>           """
>           Common routine to boot an x86_64 guest.
> 

Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 3/6] travis.yml: install rpm2cpio for acceptance tests
  2020-02-05 14:56 ` [PATCH v2 3/6] travis.yml: install rpm2cpio for acceptance tests Liam Merwick
@ 2020-02-06 14:27   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 14:27 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

On 2/5/20 3:56 PM, Liam Merwick wrote:
> The extract_from_rpm() method added for the PVH acceptance tests needs
> rpm2cpio to extract a vmlinux binary from an RPM.
> 
> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
> ---
>   .travis.yml | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/.travis.yml b/.travis.yml
> index 3b35b7cf04d3..59773365823e 100644
> --- a/.travis.yml
> +++ b/.travis.yml
> @@ -323,6 +323,7 @@ matrix:
>               - python3-pil
>               - python3-pip
>               - python3.5-venv
> +            - rpm2cpio
>               - tesseract-ocr
>               - tesseract-ocr-eng
>   
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test
  2020-02-06 14:09     ` Philippe Mathieu-Daudé
@ 2020-02-06 15:05       ` Liam Merwick
  2020-02-19 19:02         ` Wainer dos Santos Moschetta
  0 siblings, 1 reply; 19+ messages in thread
From: Liam Merwick @ 2020-02-06 15:05 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

On 06/02/2020 14:09, Philippe Mathieu-Daudé wrote:
> Hi Liam,
> 
> On 2/6/20 2:57 PM, Philippe Mathieu-Daudé wrote:
>> On 2/5/20 3:56 PM, Liam Merwick wrote:
>>> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
>>> functions which specify the Avocado tag of ':avocado: tags=machine:'
>>> as being either 'pc' or 'microvm' can be used to test booting a
>>> compressed kernel using either machine class.
>>>
>>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>> ---
>>>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>>>   1 file changed, 17 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tests/acceptance/boot_linux_console.py 
>>> b/tests/acceptance/boot_linux_console.py
>>> index e40b84651b0b..233601b429bd 100644
>>> --- a/tests/acceptance/boot_linux_console.py
>>> +++ b/tests/acceptance/boot_linux_console.py
>>> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>>>           os.chdir(cwd)
>>>           return self.workdir + path
>>> -    def test_x86_64_pc(self):
>>> +    def do_test_x86_64_machine(self):
>>>           """
>>> -        :avocado: tags=arch:x86_64
>>> -        :avocado: tags=machine:pc
>>> +        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'
>>> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>>>           console_pattern = 'Kernel command line: %s' % 
>>> kernel_command_line
>>>           self.wait_for_console_pattern(console_pattern)
>>> +    def test_x86_64_pc(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:pc
>>> +        """
>>> +        self.do_test_x86_64_machine()
>>> +
>>> +    def test_x86_64_microvm(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:microvm
>>> +        """
>>> +        self.do_test_x86_64_machine()
>>> +
>>>       def test_mips_malta(self):
>>>           """
>>>           :avocado: tags=arch:mips
>>>
>>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> 
> Actually this breaks testing the distrib QEMU:


I happen to have a QEMU RPM installed - how do I override 'make 
check-acceptance' to pick up /usr/bin/qemu-system-x86_64 (and 
/usr/share/qemu/bios-microvm.bin - not sure that is a universal location 
for distros)?   Overriding QTEST_QEMU_BINARY didn't seem to work for me 
- doesn't appear to apply to the check-acceptance rule.

> 
>   (1/2) 
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: 
> PASS (2.58 s)
>   (2/2) 
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_microvm: 
> 
> Output: 'qemu-system-x86_64: -machine microvm: unsupported machine 
> type\nUse -machine help to list supported machines\n'
> ERROR: timed out (15.10 s)
> 
> Do you mind testing the series testing a machine is available?
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg675086.html


Sure. I'll test/review those.

Regards,
Liam



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests
  2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
                   ` (5 preceding siblings ...)
  2020-02-05 14:56 ` [PATCH v2 6/6] tests/boot_linux_console: use os.path for filesystem paths Liam Merwick
@ 2020-02-06 15:24 ` Philippe Mathieu-Daudé
  6 siblings, 0 replies; 19+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 15:24 UTC (permalink / raw)
  To: Liam Merwick, alex.bennee, fam
  Cc: qemu-devel, pbonzini, wainersm, slp, sgarzare

On 2/5/20 3:55 PM, Liam Merwick wrote:
> Add acceptance tests for the microvm machine class, PVH, and the
> new qboot BIOS.
> 
> In the case of the test to boot an uncompressed kernel there didn't
> seem to be any suitable uncompressed kernel on https://archives.fedoraproject.org/
> (there is a vmlinux in kernel-debuginfo but that RPM is 575M and
> caused timeouts when populating the Avocado cache when first run)
> so I chose an RPM with kernels for Kata that is 14M.
> (there was a discussion in [1] regarding testing PVH boot but it focussed
> more around building a vmlinux binary during testing).
> 
> [ What prompted these patches was the discovery that a 'pc' guest booting an
> uncompressed kernel (PVH) with a PCI netdev hangs (before we even get guest
> console output) when bios-microvm.bin (qboot) is supplied via -bios
> (no issue when using 'q35' or 'microvm' machine classes).
> 
> E.g. adding the following line to test_x86_64_pc_qboot_pvh() is enough to
> trigger a guest hang during startup:
> self.vm.add_args('-netdev', 'user,id=n1', '-device', 'virtio-net-pci,netdev=n1')
> 
> I bisected that issue to 176d2cda0dee [2] in 4.1 but haven't worked out yet
> how/why the "die-id" changes impact the qboot/PVH combination
> (the boot succeeds with any subset of those boot variables).
> 
> Is booting the 'pc' machine class with bios-microvm.bin something that QEMU
> officially supports or is qboot intended for microvm only? ]
> 
> Each test added here adds about 1.5s to the overall runtime.
> I have run them through the Travis QEMU CI [3] and those acceptance tests pass.
> 
> v1 -> v2
> Removed unnecessary qboot test for microvm in Patches 2 and 5 [Stefano]
> Added SeaBIOS test for microvm to Patch2
> Fix path concatenation in Patch4 to use os.path for filesystem paths [Wanier]
> Added Patch6 to fix extract_from_deb() to use os.path for filesystem paths
> Used dictionary to store kernel info in Patch5 [Philippe]
> Dropped patch with typo fix that has been queued separately
> Added Stefano's R-b to the patches which have not significantly changed.
> 
> [1] https://patchew.org/QEMU/20191206140012.15517-1-wainersm@redhat.com/
> [2] 176d2cda0dee ("i386/cpu: Consolidate die-id validity in smp context")
> [3] https://travis-ci.org/merwick/qemu/builds/645487393
> [4] https://github.com/wainersm/qemu/commit/8f705e98df90b436b0f4946331d441309c437f7b
> 
> 
> Liam Merwick (6):
>    tests/boot_linux_console: add microvm acceptance test
>    tests/boot_linux_console: add BIOS acceptance test
>    travis.yml: install rpm2cpio for acceptance tests
>    tests/boot_linux_console: add extract_from_rpm method
>    tests/boot_linux_console: add PVH acceptance tests
>    tests/boot_linux_console: use os.path for filesystem paths
> 
>   .travis.yml                            |   1 +
>   tests/acceptance/boot_linux_console.py | 114 ++++++++++++++++++++++++++++++---
>   2 files changed, 106 insertions(+), 9 deletions(-)

Patches 3, 4 and 6 applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test
  2020-02-06 15:05       ` Liam Merwick
@ 2020-02-19 19:02         ` Wainer dos Santos Moschetta
  0 siblings, 0 replies; 19+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-19 19:02 UTC (permalink / raw)
  To: Liam Merwick, Philippe Mathieu-Daudé, alex.bennee, fam
  Cc: pbonzini, qemu-devel, slp, sgarzare

Liam,

Sorry for the long time to reply it... comments below.

On 2/6/20 1:05 PM, Liam Merwick wrote:
> On 06/02/2020 14:09, Philippe Mathieu-Daudé wrote:
>> Hi Liam,
>>
>> On 2/6/20 2:57 PM, Philippe Mathieu-Daudé wrote:
>>> On 2/5/20 3:56 PM, Liam Merwick wrote:
>>>> Refactor test_x86_64_pc() to test_x86_64_machine() so that separate
>>>> functions which specify the Avocado tag of ':avocado: tags=machine:'
>>>> as being either 'pc' or 'microvm' can be used to test booting a
>>>> compressed kernel using either machine class.
>>>>
>>>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>>>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>>> ---
>>>>   tests/acceptance/boot_linux_console.py | 20 +++++++++++++++++---
>>>>   1 file changed, 17 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/tests/acceptance/boot_linux_console.py 
>>>> b/tests/acceptance/boot_linux_console.py
>>>> index e40b84651b0b..233601b429bd 100644
>>>> --- a/tests/acceptance/boot_linux_console.py
>>>> +++ b/tests/acceptance/boot_linux_console.py
>>>> @@ -51,10 +51,10 @@ class BootLinuxConsole(Test):
>>>>           os.chdir(cwd)
>>>>           return self.workdir + path
>>>> -    def test_x86_64_pc(self):
>>>> +    def do_test_x86_64_machine(self):
>>>>           """
>>>> -        :avocado: tags=arch:x86_64
>>>> -        :avocado: tags=machine:pc
>>>> +        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'
>>>> @@ -70,6 +70,20 @@ class BootLinuxConsole(Test):
>>>>           console_pattern = 'Kernel command line: %s' % 
>>>> kernel_command_line
>>>>           self.wait_for_console_pattern(console_pattern)
>>>> +    def test_x86_64_pc(self):
>>>> +        """
>>>> +        :avocado: tags=arch:x86_64
>>>> +        :avocado: tags=machine:pc
>>>> +        """
>>>> +        self.do_test_x86_64_machine()
>>>> +
>>>> +    def test_x86_64_microvm(self):
>>>> +        """
>>>> +        :avocado: tags=arch:x86_64
>>>> +        :avocado: tags=machine:microvm
>>>> +        """
>>>> +        self.do_test_x86_64_machine()
>>>> +
>>>>       def test_mips_malta(self):
>>>>           """
>>>>           :avocado: tags=arch:mips
>>>>
>>>
>>> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>>
>> Actually this breaks testing the distrib QEMU:
>
>
> I happen to have a QEMU RPM installed - how do I override 'make 
> check-acceptance' to pick up /usr/bin/qemu-system-x86_64 (and 
> /usr/share/qemu/bios-microvm.bin - not sure that is a universal 
> location for distros)?   Overriding QTEST_QEMU_BINARY didn't seem to 
> work for me - doesn't appear to apply to the check-acceptance rule.

So far as I know you cannot override the QEMU path with `make 
check-acceptance`. If you still need to override then you need to evoke 
avocado manually. Suppose it is in the build directory, do:

$ make check-venv

$ ./tests/venv/bin/avocado run -p qemu_bin=/usr/bin/qemu-system-x86_64 
-t arch:x86_64 tests/acceptance/boot_linux_console.py

The -p option on the command above is used to pass a test parameter. The 
underlying avocado_qemu framework used on the acceptance tests 
recognizes the 'qemu_bin' parameter, which in case of its absence the 
test setup searches for a suitable QEMU built on the current directory. 
The avocado_qemu doesn't  have a parameter to indicate the path to the 
bios file, so there is no way to override it (well, not entirely true 
and I explain it on the patch 02 of this series).

Thanks!

- Wainer

>
>
>>
>>   (1/2) 
>> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc: 
>> PASS (2.58 s)
>>   (2/2) 
>> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_microvm: 
>>
>> Output: 'qemu-system-x86_64: -machine microvm: unsupported machine 
>> type\nUse -machine help to list supported machines\n'
>> ERROR: timed out (15.10 s)
>>
>> Do you mind testing the series testing a machine is available?
>> https://www.mail-archive.com/qemu-devel@nongnu.org/msg675086.html
>
>
> Sure. I'll test/review those.
>
> Regards,
> Liam
>
>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/6] tests/boot_linux_console: add BIOS acceptance test
  2020-02-06 14:12   ` Philippe Mathieu-Daudé
@ 2020-02-19 19:20     ` Wainer dos Santos Moschetta
  2020-02-26 17:36       ` Liam Merwick
  0 siblings, 1 reply; 19+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-19 19:20 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, Liam Merwick, alex.bennee, fam, Cleber Rosa
  Cc: pbonzini, qemu-devel, slp, sgarzare


On 2/6/20 12:12 PM, Philippe Mathieu-Daudé wrote:
> On 2/5/20 3:56 PM, Liam Merwick wrote:
>> Add a test to use qboot with the 'pc' machine class and SeaBIOS with
>> the 'microvm' machine class (since microvm uses qboot by default) by
>> adding the '-bios' option via self.vm.add_args() before
>> calling do_test_x86_64_machine().
>>
>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>> ---
>>   tests/acceptance/boot_linux_console.py | 17 ++++++++++++++++-
>>   1 file changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/tests/acceptance/boot_linux_console.py 
>> b/tests/acceptance/boot_linux_console.py
>> index 233601b429bd..e9375590bc1c 100644
>> --- a/tests/acceptance/boot_linux_console.py
>> +++ b/tests/acceptance/boot_linux_console.py
>> @@ -61,7 +61,6 @@ class BootLinuxConsole(Test):
>>                         '/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,
>> @@ -77,6 +76,14 @@ class BootLinuxConsole(Test):
>>           """
>>           self.do_test_x86_64_machine()
>>   +    def test_x86_64_pc_qboot(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:pc
>> +        """
>> +        self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')

The test boots QEMU with bios file from $PWD/pc-bios/bios-microvm.bin. 
If you want to get (optionally) the file from an installed QEMU you 
could use Avocado test parameters [1]. Here goes an example:

self.vm.add_args('-bios', self.params.get('bios_microvm', 
default='pc-bios/bios-microvm.bin'))

Then you evoke avocado as:

$ avocado run -p bios_microvm=/usr/share/qemu/bios-microvm.bin (...)

[1] 
https://avocado-framework.readthedocs.io/en/75.1/guides/writer/chapters/parameters.html


>>
>
> This breaks running once QEMU is installed:
>
>  (2/4) 
> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc_qboot:
> qemu: could not load PC BIOS 'pc-bios/bios-microvm.bin'
> ERROR: [Errno 104] Connection reset by peer (0.08 s)
>
> Cleber, Wainer, what path should we use?


Philippe, above answers your question?

Thanks,

- Wainer

>
>
>> +        self.do_test_x86_64_machine()
>> +
>>       def test_x86_64_microvm(self):
>>           """
>>           :avocado: tags=arch:x86_64
>> @@ -84,6 +91,14 @@ class BootLinuxConsole(Test):
>>           """
>>           self.do_test_x86_64_machine()
>>   +    def test_x86_64_microvm_seabios(self):
>> +        """
>> +        :avocado: tags=arch:x86_64
>> +        :avocado: tags=machine:microvm
>> +        """
>> +        self.vm.add_args('-bios', 'pc-bios/bios.bin')
>> +        self.do_test_x86_64_machine()
>> +
>>       def test_mips_malta(self):
>>           """
>>           :avocado: tags=arch:mips
>>
>



^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH v2 2/6] tests/boot_linux_console: add BIOS acceptance test
  2020-02-19 19:20     ` Wainer dos Santos Moschetta
@ 2020-02-26 17:36       ` Liam Merwick
  0 siblings, 0 replies; 19+ messages in thread
From: Liam Merwick @ 2020-02-26 17:36 UTC (permalink / raw)
  To: Wainer dos Santos Moschetta, Philippe Mathieu-Daudé,
	alex.bennee, fam, Cleber Rosa
  Cc: pbonzini, qemu-devel, slp, sgarzare

On 19/02/2020 19:20, Wainer dos Santos Moschetta wrote:
> 
> On 2/6/20 12:12 PM, Philippe Mathieu-Daudé wrote:
>> On 2/5/20 3:56 PM, Liam Merwick wrote:
>>> Add a test to use qboot with the 'pc' machine class and SeaBIOS with
>>> the 'microvm' machine class (since microvm uses qboot by default) by
>>> adding the '-bios' option via self.vm.add_args() before
>>> calling do_test_x86_64_machine().
>>>
>>> Signed-off-by: Liam Merwick <liam.merwick@oracle.com>
>>> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>>> ---
>>>   tests/acceptance/boot_linux_console.py | 17 ++++++++++++++++-
>>>   1 file changed, 16 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/tests/acceptance/boot_linux_console.py 
>>> b/tests/acceptance/boot_linux_console.py
>>> index 233601b429bd..e9375590bc1c 100644
>>> --- a/tests/acceptance/boot_linux_console.py
>>> +++ b/tests/acceptance/boot_linux_console.py
>>> @@ -61,7 +61,6 @@ class BootLinuxConsole(Test):
>>>                         '/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,
>>> @@ -77,6 +76,14 @@ class BootLinuxConsole(Test):
>>>           """
>>>           self.do_test_x86_64_machine()
>>>   +    def test_x86_64_pc_qboot(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:pc
>>> +        """
>>> +        self.vm.add_args('-bios', 'pc-bios/bios-microvm.bin')
> 
> The test boots QEMU with bios file from $PWD/pc-bios/bios-microvm.bin. 
> If you want to get (optionally) the file from an installed QEMU you 
> could use Avocado test parameters [1]. Here goes an example:
> 
> self.vm.add_args('-bios', self.params.get('bios_microvm', 
> default='pc-bios/bios-microvm.bin'))
> 
> Then you evoke avocado as:
> 
> $ avocado run -p bios_microvm=/usr/share/qemu/bios-microvm.bin (...)
> 
> [1] 
> https://avocado-framework.readthedocs.io/en/75.1/guides/writer/chapters/parameters.html 
> 
> 

Thanks Wainer - that works well for my patches.

Regards,
Liam


> 
>>>
>>
>> This breaks running once QEMU is installed:
>>
>>  (2/4) 
>> tests/acceptance/boot_linux_console.py:BootLinuxConsole.test_x86_64_pc_qboot: 
>>
>> qemu: could not load PC BIOS 'pc-bios/bios-microvm.bin'
>> ERROR: [Errno 104] Connection reset by peer (0.08 s)
>>
>> Cleber, Wainer, what path should we use?
> 
> 
> Philippe, above answers your question?
> 
> Thanks,
> 
> - Wainer
> 
>>
>>
>>> +        self.do_test_x86_64_machine()
>>> +
>>>       def test_x86_64_microvm(self):
>>>           """
>>>           :avocado: tags=arch:x86_64
>>> @@ -84,6 +91,14 @@ class BootLinuxConsole(Test):
>>>           """
>>>           self.do_test_x86_64_machine()
>>>   +    def test_x86_64_microvm_seabios(self):
>>> +        """
>>> +        :avocado: tags=arch:x86_64
>>> +        :avocado: tags=machine:microvm
>>> +        """
>>> +        self.vm.add_args('-bios', 'pc-bios/bios.bin')
>>> +        self.do_test_x86_64_machine()
>>> +
>>>       def test_mips_malta(self):
>>>           """
>>>           :avocado: tags=arch:mips
>>>
>>
> 



^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2020-02-26 17:37 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 14:55 [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Liam Merwick
2020-02-05 14:56 ` [PATCH v2 1/6] tests/boot_linux_console: add microvm acceptance test Liam Merwick
2020-02-06 13:57   ` Philippe Mathieu-Daudé
2020-02-06 14:09     ` Philippe Mathieu-Daudé
2020-02-06 15:05       ` Liam Merwick
2020-02-19 19:02         ` Wainer dos Santos Moschetta
2020-02-05 14:56 ` [PATCH v2 2/6] tests/boot_linux_console: add BIOS " Liam Merwick
2020-02-06 14:12   ` Philippe Mathieu-Daudé
2020-02-19 19:20     ` Wainer dos Santos Moschetta
2020-02-26 17:36       ` Liam Merwick
2020-02-05 14:56 ` [PATCH v2 3/6] travis.yml: install rpm2cpio for acceptance tests Liam Merwick
2020-02-06 14:27   ` Philippe Mathieu-Daudé
2020-02-05 14:56 ` [PATCH v2 4/6] tests/boot_linux_console: add extract_from_rpm method Liam Merwick
2020-02-06 14:27   ` Philippe Mathieu-Daudé
2020-02-05 14:56 ` [PATCH v2 5/6] tests/boot_linux_console: add PVH acceptance tests Liam Merwick
2020-02-06 14:24   ` Philippe Mathieu-Daudé
2020-02-05 14:56 ` [PATCH v2 6/6] tests/boot_linux_console: use os.path for filesystem paths Liam Merwick
2020-02-06 14:26   ` Philippe Mathieu-Daudé
2020-02-06 15:24 ` [PATCH v2 0/6] tests/boot_linux_console: add extra boot acceptance tests Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.