qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test
@ 2020-02-05 20:32 Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 1/8] tests/acceptance: avocado_qemu: Introduce the 'accel' test parameter Wainer dos Santos Moschetta
                   ` (8 more replies)
  0 siblings, 9 replies; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

This adds boot Linux tests for x86_64, aarch64, ppc64, and s390x
targets which, unlike others, enable the KVM acceleration. Likewise
it was added test cases for tcg.

It is introduced an infraestructure on avocado_qemu framework
so that:
a) simply tagging the test with `accel:kvm` (or `accel:tcg`) will
automatically set the corresponding '-accel' on the launched
QEMU;
b) test is canceled if the accelerator is not enabled on the QEMU
binary or not available in the host. In special, it checks if SMT
is disabled on POWER8.

The acceptance builder on Travis was changed too in order to make
the test run.

Changes v3 -> v4:
- Broke changes per-arch to ease the reviews. Resulting on
  patches 02, 03, 05, 06.
- The test for aarch64 now passes '-cpu max' and
  -M 'virt,gic-version=max'. (patch 03) [drjones]
- Added a fix to accel.kvm_available() so that it detects
  correctly the availability of kvm on ppc64le. (patch 05)
- The test for ppc64le now checks if SMT is enabled on
  POWER8 then skip. 

v3: [PATCH v3 0/4] Acceptance tests: boot Linux with KVM test
- https://www.mail-archive.com/qemu-devel@nongnu.org/msg672635.html
v2: [PATCH v2 0/3] Acceptance tests: boot Linux with KVM test
- https://www.mail-archive.com/qemu-devel@nongnu.org/msg666238.html
v1: [PATCH 0/3] Acceptance tests: boot Linux with KVM test
- https://www.mail-archive.com/qemu-devel@nongnu.org/msg627498.html

Tree:
- Git: https://github.com/wainersm/qemu
- Branch: acceptance_kvm_test-v4

CI:
- Travis (FAIL): https://travis-ci.org/wainersm/qemu/builds/646154220
  Failed jobs are not related with this series changes.

Wainer dos Santos Moschetta (8):
  tests/acceptance: avocado_qemu: Introduce the 'accel' test parameter
  tests/acceptance: boot_linux_console: Add boot Linux/x86 with KVM
  tests/acceptance: boot_linux_console: Add boot Linux/aarch64 with KVM
  python/qemu: accel: Fix kvm_available() on ppc64le
  test/acceptance: boot_linux_console: Add boot Linux/ppc64le with KVM
  tests/acceptance: boot_linux_console: Add boot Linux/s390x with KVM
  tests/acceptance: avocado_qemu: Refactor the handler of 'machine'
    parameter
  travis.yml: Enable acceptance KVM tests

 .travis.yml                               |   7 +-
 docs/devel/testing.rst                    |  16 ++++
 python/qemu/accel.py                      |   3 +-
 tests/acceptance/avocado_qemu/__init__.py |  27 +++++-
 tests/acceptance/boot_linux_console.py    | 108 +++++++++++++++++-----
 5 files changed, 136 insertions(+), 25 deletions(-)

-- 
2.24.1



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

* [PATCH v4 1/8] tests/acceptance: avocado_qemu: Introduce the 'accel' test parameter
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 2/8] tests/acceptance: boot_linux_console: Add boot Linux/x86 with KVM Wainer dos Santos Moschetta
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

The test case may need to boot the VM with an accelerator that
isn't actually enabled on the QEMU binary and/or present in the host. In
this case the test behavior is undefined, and the best course of
action is to skip its execution.

This change introduced the 'accel' parameter (and the handler of
tag with same name) used to indicate the test case requires a
given accelerator available. It was implemented a mechanism to
skip the test case if the accelerator is not available. Moreover,
 the QEMU -accel argument is set automatically to any VM
launched if the parameter is present.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 docs/devel/testing.rst                    | 16 ++++++++++++++++
 tests/acceptance/avocado_qemu/__init__.py | 23 +++++++++++++++++++++++
 2 files changed, 39 insertions(+)

diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
index ab5be0c729..d17d0e90aa 100644
--- a/docs/devel/testing.rst
+++ b/docs/devel/testing.rst
@@ -759,6 +759,17 @@ name.  If one is not given explicitly, it will either be set to
 ``None``, or, if the test is tagged with one (and only one)
 ``:avocado: tags=machine:VALUE`` tag, it will be set to ``VALUE``.
 
+accel
+~~~~~
+The accelerator that will be set to all QEMUMachine instances created
+by the test.
+
+The ``accel`` attribute will be set to the test parameter of the same
+name.  If one is not given explicitly, it will either be set to
+``None``, or, if the test is tagged with one (and only one)
+``:avocado: tags=accel:VALUE`` tag, it will be set to ``VALUE``. Currently
+``VALUE`` should be either ``kvm`` or ``tcg``.
+
 qemu_bin
 ~~~~~~~~
 
@@ -800,6 +811,11 @@ machine
 The machine type that will be set to all QEMUMachine instances created
 by the test.
 
+accel
+~~~~~
+The accelerator that will be set to all QEMUMachine instances created
+by the test. In case the accelerator is not available (both QEMU
+binary and the host system are checked) then the test is canceled.
 
 qemu_bin
 ~~~~~~~~
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 6618ea67c1..c83a75ccbc 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -20,6 +20,7 @@ SRC_ROOT_DIR = os.path.join(os.path.dirname(__file__), '..', '..', '..')
 sys.path.append(os.path.join(SRC_ROOT_DIR, 'python'))
 
 from qemu.machine import QEMUMachine
+from qemu.accel import kvm_available, tcg_available
 
 def is_readable_executable_file(path):
     return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
@@ -111,6 +112,8 @@ class Test(avocado.Test):
 
     def setUp(self):
         self._vms = {}
+        # VM argumments that are mapped from parameters
+        self._param_to_vm_args = []
 
         self.arch = self.params.get('arch',
                                     default=self._get_unique_tag_val('arch'))
@@ -124,10 +127,30 @@ class Test(avocado.Test):
         if self.qemu_bin is None:
             self.cancel("No QEMU binary defined or found in the source tree")
 
+        self.accel = self.params.get('accel',
+                                     default=self._get_unique_tag_val('accel'))
+        if self.accel:
+            avail = False
+            if self.accel == 'kvm':
+                if kvm_available(self.arch, self.qemu_bin):
+                    avail = True
+            elif self.accel == 'tcg':
+                if tcg_available(self.qemu_bin):
+                    avail = True
+            else:
+                self.cancel("Unknown accelerator: %s" % self.accel)
+
+            if avail:
+                self._param_to_vm_args.extend(['-accel', self.accel])
+            else:
+                self.cancel("%s is not available" % self.accel)
+
     def _new_vm(self, *args):
         vm = QEMUMachine(self.qemu_bin, sock_dir=tempfile.mkdtemp())
         if args:
             vm.add_args(*args)
+        if self._param_to_vm_args:
+            vm.add_args(*self._param_to_vm_args)
         return vm
 
     @property
-- 
2.24.1



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

* [PATCH v4 2/8] tests/acceptance: boot_linux_console: Add boot Linux/x86 with KVM
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 1/8] tests/acceptance: avocado_qemu: Introduce the 'accel' test parameter Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 3/8] tests/acceptance: boot_linux_console: Add boot Linux/aarch64 " Wainer dos Santos Moschetta
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

Added boot Linux on x86_64 test case that launch QEMU with KVM
enabled. Likewise it was added one test for TCG.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index e40b84651b..fc72cdde0d 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -51,11 +51,7 @@ class BootLinuxConsole(Test):
         os.chdir(cwd)
         return self.workdir + path
 
-    def test_x86_64_pc(self):
-        """
-        :avocado: tags=arch:x86_64
-        :avocado: tags=machine:pc
-        """
+    def do_test_x86_64_pc(self):
         kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
                       '/linux/releases/29/Everything/x86_64/os/images/pxeboot'
                       '/vmlinuz')
@@ -70,6 +66,22 @@ class BootLinuxConsole(Test):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_x86_64_pc_kvm(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:pc
+        :avocado: tags=accel:kvm
+        """
+        self.do_test_x86_64_pc()
+
+    def test_x86_64_pc_tcg(self):
+        """
+        :avocado: tags=arch:x86_64
+        :avocado: tags=machine:pc
+        :avocado: tags=accel:tcg
+        """
+        self.do_test_x86_64_pc()
+
     def test_mips_malta(self):
         """
         :avocado: tags=arch:mips
-- 
2.24.1



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

* [PATCH v4 3/8] tests/acceptance: boot_linux_console: Add boot Linux/aarch64 with KVM
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 1/8] tests/acceptance: avocado_qemu: Introduce the 'accel' test parameter Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 2/8] tests/acceptance: boot_linux_console: Add boot Linux/x86 with KVM Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 4/8] python/qemu: accel: Fix kvm_available() on ppc64le Wainer dos Santos Moschetta
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

This split in two the boot Linux test for aarch64: one that uses
KVM acceleration and another with TCG. It changes -cpu to 'max'
which is a common match between kvm and tcg.

Note: on kvm test, even though it is tagged with 'machine:virt', it later
has the value overwritten to pass the GIC version. The reason for that
is an Avocado limitation, which is unable to parse correctly a
tag containing ',' (this char being a tag delimiter). Keep the
'machine:virt' tag is still useful since it can be used on tests
filtering.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index fc72cdde0d..76a66ee533 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -270,11 +270,7 @@ class BootLinuxConsole(Test):
         kernel_hash = '18d1c68f2e23429e266ca39ba5349ccd0aeb7180'
         self.do_test_mips_malta32el_nanomips(kernel_url, kernel_hash)
 
-    def test_aarch64_virt(self):
-        """
-        :avocado: tags=arch:aarch64
-        :avocado: tags=machine:virt
-        """
+    def do_test_aarch64_virt(self):
         kernel_url = ('https://archives.fedoraproject.org/pub/archive/fedora'
                       '/linux/releases/29/Everything/aarch64/os/images/pxeboot'
                       '/vmlinuz')
@@ -284,13 +280,30 @@ class BootLinuxConsole(Test):
         self.vm.set_console()
         kernel_command_line = (self.KERNEL_COMMON_COMMAND_LINE +
                                'console=ttyAMA0')
-        self.vm.add_args('-cpu', 'cortex-a53',
+        self.vm.add_args('-cpu', 'max',
                          '-kernel', kernel_path,
                          '-append', kernel_command_line)
         self.vm.launch()
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_aarch64_virt_kvm(self):
+        """
+        :avocado: tags=arch:aarch64
+        :avocado: tags=machine:virt
+        :avocado: tags=accel:kvm
+        """
+        self.vm.set_machine('virt,gic-version=max')
+        self.do_test_aarch64_virt()
+
+    def test_aarch64_virt_tcg(self):
+        """
+        :avocado: tags=arch:aarch64
+        :avocado: tags=machine:virt
+        :avocado: tags=accel:tcg
+        """
+        self.do_test_aarch64_virt()
+
     def test_arm_virt(self):
         """
         :avocado: tags=arch:arm
-- 
2.24.1



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

* [PATCH v4 4/8] python/qemu: accel: Fix kvm_available() on ppc64le
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
                   ` (2 preceding siblings ...)
  2020-02-05 20:32 ` [PATCH v4 3/8] tests/acceptance: boot_linux_console: Add boot Linux/aarch64 " Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-06 15:43   ` Philippe Mathieu-Daudé
  2020-02-05 20:32 ` [PATCH v4 5/8] test/acceptance: boot_linux_console: Add boot Linux/ppc64le with KVM Wainer dos Santos Moschetta
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

On ppc64le, the accel.kvm_available() check may wrongly
return False because the host arch (as returned by os.uname[4])
and the target arch (ppc64) mismatch. In order to solve this
it is added an ppc64le -> ppc64 mapping which is used as an
fallback verification.

Fixes: 53a049d7d78e5ccf6d4c0d7
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 python/qemu/accel.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/python/qemu/accel.py b/python/qemu/accel.py
index 0b38ddf0ab..36ae85791e 100644
--- a/python/qemu/accel.py
+++ b/python/qemu/accel.py
@@ -24,7 +24,8 @@ LOG = logging.getLogger(__name__)
 # support which often includes its 32 bit cousin.
 ADDITIONAL_ARCHES = {
     "x86_64" : "i386",
-    "aarch64" : "armhf"
+    "aarch64" : "armhf",
+    "ppc64le" : "ppc64",
 }
 
 def list_accel(qemu_bin):
-- 
2.24.1



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

* [PATCH v4 5/8] test/acceptance: boot_linux_console: Add boot Linux/ppc64le with KVM
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
                   ` (3 preceding siblings ...)
  2020-02-05 20:32 ` [PATCH v4 4/8] python/qemu: accel: Fix kvm_available() on ppc64le Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 6/8] tests/acceptance: boot_linux_console: Add boot Linux/s390x " Wainer dos Santos Moschetta
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

Likewise this splitted the boot Linux for ppc64le test in a version
for KVM and another for TCG.

The kvm test case is designed to run on POWER8 or greater, otherwise
it is skipped. The SMT should be off on POWER8, that is also checked.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 39 ++++++++++++++++++++++----
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index 76a66ee533..ca385c90a4 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -19,6 +19,8 @@ from avocado_qemu import exec_command_and_wait_for_pattern
 from avocado_qemu import wait_for_console_pattern
 from avocado.utils import process
 from avocado.utils import archive
+from avocado.utils.cpu import get_cpu_vendor_name
+from avocado.utils.path import find_command
 
 
 class BootLinuxConsole(Test):
@@ -551,11 +553,7 @@ class BootLinuxConsole(Test):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
-    def test_ppc64_pseries(self):
-        """
-        :avocado: tags=arch:ppc64
-        :avocado: tags=machine:pseries
-        """
+    def do_test_ppc64_pseries(self):
         kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                       '/fedora-secondary/releases/29/Everything/ppc64le/os'
                       '/ppc/ppc64/vmlinuz')
@@ -570,6 +568,37 @@ class BootLinuxConsole(Test):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    @skipUnless(find_command('ppc64_cpu', default=False))
+    def test_ppc64_pseries_kvm(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:kvm
+
+        It assumes running on POWER8 or greater, otherwise skip the test.
+        If on POWER8 then SMT should be off, otherwise skip the test.
+        """
+        cpu = get_cpu_vendor_name()
+        if not cpu.startswith('power'):
+            self.cancel('do not test with %s cpu' % cpu)
+        else:
+            version = int(cpu.replace('power', ''))
+            if version < 8:
+                self.cancel('cpu %s is not >= POWER8')
+            elif version == 8:
+                smt = process.run('ppc64_cpu --smt -n').stdout_text.strip()
+                if smt != 'SMT=1':
+                    self.cancel('%s on POWER8' % smt)
+        self.do_test_ppc64_pseries()
+
+    def test_ppc64_pseries_tcg(self):
+        """
+        :avocado: tags=arch:ppc64
+        :avocado: tags=machine:pseries
+        :avocado: tags=accel:tcg
+        """
+        self.do_test_ppc64_pseries()
+
     def test_m68k_q800(self):
         """
         :avocado: tags=arch:m68k
-- 
2.24.1



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

* [PATCH v4 6/8] tests/acceptance: boot_linux_console: Add boot Linux/s390x with KVM
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
                   ` (4 preceding siblings ...)
  2020-02-05 20:32 ` [PATCH v4 5/8] test/acceptance: boot_linux_console: Add boot Linux/ppc64le with KVM Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-05 20:32 ` [PATCH v4 7/8] tests/acceptance: avocado_qemu: Refactor the handler of 'machine' parameter Wainer dos Santos Moschetta
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

Yet another splitting of boot the Linux tests between KVM and TCG. This
time for s390x.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 tests/acceptance/boot_linux_console.py | 22 +++++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/tests/acceptance/boot_linux_console.py b/tests/acceptance/boot_linux_console.py
index ca385c90a4..2256623f7e 100644
--- a/tests/acceptance/boot_linux_console.py
+++ b/tests/acceptance/boot_linux_console.py
@@ -512,11 +512,7 @@ class BootLinuxConsole(Test):
         exec_command_and_wait_for_pattern(self, 'reboot',
                                                 'reboot: Restarting system')
 
-    def test_s390x_s390_ccw_virtio(self):
-        """
-        :avocado: tags=arch:s390x
-        :avocado: tags=machine:s390-ccw-virtio
-        """
+    def do_test_s390x_s390_ccw_virtio(self):
         kernel_url = ('https://archives.fedoraproject.org/pub/archive'
                       '/fedora-secondary/releases/29/Everything/s390x/os/images'
                       '/kernel.img')
@@ -532,6 +528,22 @@ class BootLinuxConsole(Test):
         console_pattern = 'Kernel command line: %s' % kernel_command_line
         self.wait_for_console_pattern(console_pattern)
 
+    def test_s390x_s390_ccw_virtio_kvm(self):
+        """
+        :avocado: tags=arch:s390x
+        :avocado: tags=machine:s390-ccw-virtio
+        :avocado: tags=accel:kvm
+        """
+        self.do_test_s390x_s390_ccw_virtio()
+
+    def test_s390x_s390_ccw_virtio_tcg(self):
+        """
+        :avocado: tags=arch:s390x
+        :avocado: tags=machine:s390-ccw-virtio
+        :avocado: tags=accel:tcg
+        """
+        self.do_test_s390x_s390_ccw_virtio()
+
     def test_alpha_clipper(self):
         """
         :avocado: tags=arch:alpha
-- 
2.24.1



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

* [PATCH v4 7/8] tests/acceptance: avocado_qemu: Refactor the handler of 'machine' parameter
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
                   ` (5 preceding siblings ...)
  2020-02-05 20:32 ` [PATCH v4 6/8] tests/acceptance: boot_linux_console: Add boot Linux/s390x " Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-06 15:41   ` Philippe Mathieu-Daudé
  2020-02-05 20:32 ` [PATCH v4 8/8] travis.yml: Enable acceptance KVM tests Wainer dos Santos Moschetta
  2020-02-10 14:53 ` [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Philippe Mathieu-Daudé
  8 siblings, 1 reply; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

The Test._param_to_vm_args variable contain VM arguments that should be added
at launch which were originated from test parameters. Use this variable
to set -M from 'machine' parameter as well.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 tests/acceptance/avocado_qemu/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index c83a75ccbc..443ac02aff 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -120,6 +120,8 @@ class Test(avocado.Test):
 
         self.machine = self.params.get('machine',
                                        default=self._get_unique_tag_val('machine'))
+        if self.machine:
+            self._param_to_vm_args.extend(['-M', self.machine])
 
         default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
         self.qemu_bin = self.params.get('qemu_bin',
@@ -162,8 +164,6 @@ class Test(avocado.Test):
             name = str(uuid.uuid4())
         if self._vms.get(name) is None:
             self._vms[name] = self._new_vm(*args)
-            if self.machine is not None:
-                self._vms[name].set_machine(self.machine)
         return self._vms[name]
 
     def tearDown(self):
-- 
2.24.1



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

* [PATCH v4 8/8] travis.yml: Enable acceptance KVM tests
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
                   ` (6 preceding siblings ...)
  2020-02-05 20:32 ` [PATCH v4 7/8] tests/acceptance: avocado_qemu: Refactor the handler of 'machine' parameter Wainer dos Santos Moschetta
@ 2020-02-05 20:32 ` Wainer dos Santos Moschetta
  2020-02-10 14:53 ` [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Philippe Mathieu-Daudé
  8 siblings, 0 replies; 12+ messages in thread
From: Wainer dos Santos Moschetta @ 2020-02-05 20:32 UTC (permalink / raw)
  To: qemu-devel; +Cc: drjones, ehabkost, philmd, thuth, crosa, alex.bennee

Some acceptance tests require KVM or they are skipped. Travis
enables nested virtualization by default with Ubuntu
18.04 (Bionic) on x86_64. So in order to run the kvm tests, this
changed the acceptance builder to run in a Bionic VM. Also
it was needed to ensure the current user has rw permission
to /dev/kvm.

python3.5-venv is not packaged on Bionic. So it was replaced
with python3.6-venv.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 .travis.yml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index 1ae645e9fc..76fc828887 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -2,6 +2,7 @@
 # Additional builds with specific requirements for a full VM need to
 # be added as additional matrix: entries later on
 dist: xenial
+sudo: true
 language: c
 compiler:
   - gcc
@@ -83,6 +84,9 @@ git:
 
 before_script:
   - if command -v ccache ; then ccache --zero-stats ; fi
+  - if [[ -c /dev/kvm ]] && ! [[ -r /dev/kvm && -w /dev/kvm ]]; then
+        sudo chmod o+rw /dev/kvm ;
+    fi
   - mkdir -p ${BUILD_DIR} && cd ${BUILD_DIR}
   - ${SRC_DIR}/configure ${BASE_CONFIG} ${CONFIG} || { cat config.log && exit 1; }
 script:
@@ -272,12 +276,13 @@ matrix:
         - TEST_CMD="make check-acceptance"
       after_script:
         - python3 -c 'import json; r = json.load(open("tests/results/latest/results.json")); [print(t["logfile"]) for t in r["tests"] if t["status"] not in ("PASS", "SKIP")]' | xargs cat
+      dist: bionic
       addons:
         apt:
           packages:
             - python3-pil
             - python3-pip
-            - python3.5-venv
+            - python3.6-venv
             - tesseract-ocr
             - tesseract-ocr-eng
 
-- 
2.24.1



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

* Re: [PATCH v4 7/8] tests/acceptance: avocado_qemu: Refactor the handler of 'machine' parameter
  2020-02-05 20:32 ` [PATCH v4 7/8] tests/acceptance: avocado_qemu: Refactor the handler of 'machine' parameter Wainer dos Santos Moschetta
@ 2020-02-06 15:41   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 15:41 UTC (permalink / raw)
  To: Wainer dos Santos Moschetta, qemu-devel
  Cc: drjones, thuth, alex.bennee, ehabkost, crosa

On 2/5/20 9:32 PM, Wainer dos Santos Moschetta wrote:
> The Test._param_to_vm_args variable contain VM arguments that should be added
> at launch which were originated from test parameters. Use this variable
> to set -M from 'machine' parameter as well.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>   tests/acceptance/avocado_qemu/__init__.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index c83a75ccbc..443ac02aff 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -120,6 +120,8 @@ class Test(avocado.Test):
>   
>           self.machine = self.params.get('machine',
>                                          default=self._get_unique_tag_val('machine'))
> +        if self.machine:
> +            self._param_to_vm_args.extend(['-M', self.machine])
>   
>           default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
>           self.qemu_bin = self.params.get('qemu_bin',
> @@ -162,8 +164,6 @@ class Test(avocado.Test):
>               name = str(uuid.uuid4())
>           if self._vms.get(name) is None:
>               self._vms[name] = self._new_vm(*args)
> -            if self.machine is not None:
> -                self._vms[name].set_machine(self.machine)
>           return self._vms[name]
>   
>       def tearDown(self):
> 

It would be cleaner if you add _param_to_vm_args[] with this fix as 1st 
patch of the series, then 2nd patch 'Introduce the 'accel' test 
parameter' on top.



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

* Re: [PATCH v4 4/8] python/qemu: accel: Fix kvm_available() on ppc64le
  2020-02-05 20:32 ` [PATCH v4 4/8] python/qemu: accel: Fix kvm_available() on ppc64le Wainer dos Santos Moschetta
@ 2020-02-06 15:43   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-06 15:43 UTC (permalink / raw)
  To: Wainer dos Santos Moschetta, qemu-devel
  Cc: drjones, thuth, alex.bennee, ehabkost, crosa

On 2/5/20 9:32 PM, Wainer dos Santos Moschetta wrote:
> On ppc64le, the accel.kvm_available() check may wrongly
> return False because the host arch (as returned by os.uname[4])
> and the target arch (ppc64) mismatch. In order to solve this
> it is added an ppc64le -> ppc64 mapping which is used as an
> fallback verification.
> 
> Fixes: 53a049d7d78e5ccf6d4c0d7
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
>   python/qemu/accel.py | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/python/qemu/accel.py b/python/qemu/accel.py
> index 0b38ddf0ab..36ae85791e 100644
> --- a/python/qemu/accel.py
> +++ b/python/qemu/accel.py
> @@ -24,7 +24,8 @@ LOG = logging.getLogger(__name__)
>   # support which often includes its 32 bit cousin.
>   ADDITIONAL_ARCHES = {
>       "x86_64" : "i386",
> -    "aarch64" : "armhf"
> +    "aarch64" : "armhf",
> +    "ppc64le" : "ppc64",
>   }
>   
>   def list_accel(qemu_bin):
> 

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

And applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next



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

* Re: [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test
  2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
                   ` (7 preceding siblings ...)
  2020-02-05 20:32 ` [PATCH v4 8/8] travis.yml: Enable acceptance KVM tests Wainer dos Santos Moschetta
@ 2020-02-10 14:53 ` Philippe Mathieu-Daudé
  8 siblings, 0 replies; 12+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-02-10 14:53 UTC (permalink / raw)
  To: Wainer dos Santos Moschetta, qemu-devel
  Cc: drjones, thuth, alex.bennee, ehabkost, crosa

Hi Wainer,

On 2/5/20 9:32 PM, Wainer dos Santos Moschetta wrote:
> This adds boot Linux tests for x86_64, aarch64, ppc64, and s390x
> targets which, unlike others, enable the KVM acceleration. Likewise
> it was added test cases for tcg.
> 
> It is introduced an infraestructure on avocado_qemu framework
> so that:
> a) simply tagging the test with `accel:kvm` (or `accel:tcg`) will
> automatically set the corresponding '-accel' on the launched
> QEMU;
> b) test is canceled if the accelerator is not enabled on the QEMU
> binary or not available in the host. In special, it checks if SMT
> is disabled on POWER8.
> 
> The acceptance builder on Travis was changed too in order to make
> the test run.
> 
> Changes v3 -> v4:
> - Broke changes per-arch to ease the reviews. Resulting on
>    patches 02, 03, 05, 06.
> - The test for aarch64 now passes '-cpu max' and
>    -M 'virt,gic-version=max'. (patch 03) [drjones]
> - Added a fix to accel.kvm_available() so that it detects
>    correctly the availability of kvm on ppc64le. (patch 05)
> - The test for ppc64le now checks if SMT is enabled on
>    POWER8 then skip.
> 
> v3: [PATCH v3 0/4] Acceptance tests: boot Linux with KVM test
> - https://www.mail-archive.com/qemu-devel@nongnu.org/msg672635.html
> v2: [PATCH v2 0/3] Acceptance tests: boot Linux with KVM test
> - https://www.mail-archive.com/qemu-devel@nongnu.org/msg666238.html
> v1: [PATCH 0/3] Acceptance tests: boot Linux with KVM test
> - https://www.mail-archive.com/qemu-devel@nongnu.org/msg627498.html
> 
> Tree:
> - Git: https://github.com/wainersm/qemu
> - Branch: acceptance_kvm_test-v4
> 
> CI:
> - Travis (FAIL): https://travis-ci.org/wainersm/qemu/builds/646154220
>    Failed jobs are not related with this series changes.
> 
> Wainer dos Santos Moschetta (8):
>    tests/acceptance: avocado_qemu: Introduce the 'accel' test parameter
>    tests/acceptance: boot_linux_console: Add boot Linux/x86 with KVM
>    tests/acceptance: boot_linux_console: Add boot Linux/aarch64 with KVM
>    python/qemu: accel: Fix kvm_available() on ppc64le
>    test/acceptance: boot_linux_console: Add boot Linux/ppc64le with KVM
>    tests/acceptance: boot_linux_console: Add boot Linux/s390x with KVM
>    tests/acceptance: avocado_qemu: Refactor the handler of 'machine'
>      parameter
>    travis.yml: Enable acceptance KVM tests
> 
>   .travis.yml                               |   7 +-
>   docs/devel/testing.rst                    |  16 ++++
>   python/qemu/accel.py                      |   3 +-
>   tests/acceptance/avocado_qemu/__init__.py |  27 +++++-
>   tests/acceptance/boot_linux_console.py    | 108 +++++++++++++++++-----
>   5 files changed, 136 insertions(+), 25 deletions(-)

As I'm not sure this is the correct to do, I'll defer this review to Cleber.
We can also have a look at it during the next Avocado call.



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

end of thread, other threads:[~2020-02-10 14:54 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-05 20:32 [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Wainer dos Santos Moschetta
2020-02-05 20:32 ` [PATCH v4 1/8] tests/acceptance: avocado_qemu: Introduce the 'accel' test parameter Wainer dos Santos Moschetta
2020-02-05 20:32 ` [PATCH v4 2/8] tests/acceptance: boot_linux_console: Add boot Linux/x86 with KVM Wainer dos Santos Moschetta
2020-02-05 20:32 ` [PATCH v4 3/8] tests/acceptance: boot_linux_console: Add boot Linux/aarch64 " Wainer dos Santos Moschetta
2020-02-05 20:32 ` [PATCH v4 4/8] python/qemu: accel: Fix kvm_available() on ppc64le Wainer dos Santos Moschetta
2020-02-06 15:43   ` Philippe Mathieu-Daudé
2020-02-05 20:32 ` [PATCH v4 5/8] test/acceptance: boot_linux_console: Add boot Linux/ppc64le with KVM Wainer dos Santos Moschetta
2020-02-05 20:32 ` [PATCH v4 6/8] tests/acceptance: boot_linux_console: Add boot Linux/s390x " Wainer dos Santos Moschetta
2020-02-05 20:32 ` [PATCH v4 7/8] tests/acceptance: avocado_qemu: Refactor the handler of 'machine' parameter Wainer dos Santos Moschetta
2020-02-06 15:41   ` Philippe Mathieu-Daudé
2020-02-05 20:32 ` [PATCH v4 8/8] travis.yml: Enable acceptance KVM tests Wainer dos Santos Moschetta
2020-02-10 14:53 ` [PATCH v4 0/8] Acceptance tests: boot Linux with KVM test Philippe Mathieu-Daudé

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).