[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 20/29] tests/acceptance/virtio_check_params: Skip test if arch
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v2 20/29] tests/acceptance/virtio_check_params: Skip test if arch is not supported |
Date: |
Wed, 29 Jan 2020 22:23:36 +0100 |
Refactor the X86 specific code. If we run this test on an
architecture which is not explicitly supported, the test
will be cancelled (skipped).
Signed-off-by: Philippe Mathieu-Daudé <address@hidden>
---
tests/acceptance/virtio_check_params.py | 37 +++++++++++++++----------
1 file changed, 23 insertions(+), 14 deletions(-)
diff --git a/tests/acceptance/virtio_check_params.py
b/tests/acceptance/virtio_check_params.py
index ad736bcda3..8752e25f08 100755
--- a/tests/acceptance/virtio_check_params.py
+++ b/tests/acceptance/virtio_check_params.py
@@ -26,6 +26,8 @@ import logging
sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python'))
from qemu.machine import QEMUMachine
from avocado_qemu import Test
+from qemu.binutils import binary_get_arch
+from avocado.core.exceptions import TestCancel
#list of machine types and virtqueue properties to test
VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}
@@ -96,18 +98,21 @@ class VirtioMaxSegSettingsCheck(Test):
self.assertEqual(expected_val, prop_val)
@staticmethod
- def seg_max_adjust_enabled(mt):
- # machine types >= 5.0 should have seg_max_adjust = true
- # others seg_max_adjust = false
- mt = mt.split("-")
+ def seg_max_adjust_enabled(arch, mt):
+ if arch in ['i386', 'x86_64']:
+ # machine types >= 5.0 should have seg_max_adjust = true
+ # others seg_max_adjust = false
+ mt = mt.split("-")
- # machine types with one line name and name like pc-x.x
- if len(mt) <= 2:
- return False
+ # machine types with one line name and name like pc-x.x
+ if len(mt) <= 2:
+ return False
- # machine types like pc-<chip_name>-x.x[.x]
- ver = mt[2]
- ver = ver.split(".");
+ # machine types like pc-<chip_name>-x.x[.x]
+ ver = mt[2]
+ ver = ver.split(".");
+ else:
+ raise TestCancel('Unsupported architecture: %s' % arch)
# versions >= 5.0 goes with seg_max_adjust enabled
major = int(ver[0])
@@ -117,9 +122,13 @@ class VirtioMaxSegSettingsCheck(Test):
return False
def test_machine_types(self):
- EXCLUDED_MACHINES = ['none', 'isapc', 'microvm']
- if os.geteuid() != 0:
- EXCLUDED_MACHINES += ['xenfv', 'xenpv']
+ arch = binary_get_arch(self.qemu_bin)
+
+ EXCLUDED_MACHINES = ['none']
+ if arch in ['i386', 'x86_64']:
+ EXCLUDED_MACHINES += ['isapc', 'microvm']
+ if os.geteuid() != 0:
+ EXCLUDED_MACHINES += ['xenfv', 'xenpv']
# collect all machine types except the ones in EXCLUDED_MACHINES
with QEMUMachine(self.qemu_bin) as vm:
vm.launch()
@@ -133,7 +142,7 @@ class VirtioMaxSegSettingsCheck(Test):
# create the list of machine types and their parameters.
mtypes = list()
for m in machines:
- if self.seg_max_adjust_enabled(m):
+ if self.seg_max_adjust_enabled(arch, m):
enabled = 'true'
else:
enabled = 'false'
--
2.21.1
- Re: [PATCH v2 15/29] tests: rename virtio_seg_max_adjust to virtio_check_params, (continued)
- [RFC PATCH v2 14/29] tests/acceptance: Use 'device' tags to check availability in QEMU binary, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 16/29] tests/acceptance/virtio_check_params: Only remove listed machines, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 17/29] tests/acceptance/virtio_check_params: Improve exception logging, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 19/29] tests/acceptance/virtio_check_params: Only test Xen as superuser, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 18/29] tests/acceptance/virtio_check_params: List machine being tested, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 20/29] tests/acceptance/virtio_check_params: Skip test if arch is not supported,
Philippe Mathieu-Daudé <=
- [RFC PATCH v2 21/29] tests/acceptance/virtio_check_params: Kludge to skip tests on MIPS, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 22/29] tests/acceptance/virtio_check_params: Support the s390x architecture, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 23/29] tests/acceptance/virtio_check_params: Support the ppc architecture, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 24/29] tests/acceptance/virtio_check_params: Default to -nodefaults, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 25/29] tests/acceptance/virtio_check_params: Require a virtio-scsi-pci device, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 26/29] tests/acceptance/boot_linux_console: Do not use VGA on Clipper machine, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 27/29] tests/acceptance/migration: Default to -nodefaults, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 28/29] tests/acceptance/version: Default to -nodefaults, Philippe Mathieu-Daudé, 2020/01/29
- [PATCH v2 29/29] MAINTAINERS: Add Acceptance tests reviewers, Philippe Mathieu-Daudé, 2020/01/29