tests/acceptance/virtio_seg_max_adjust: Restrict it to Linux/X86
cover tests/acceptance/virtio_seg_max_adjust: Restrict it to Linux/X86
Currently our CI is mostly restricted to Linux/X86.
We want to have more, but until there we have to run these tests manually, which is why we didn't noticed earlier this test was failing on OSX.
Actually this test might have catched a bug, see:
https://lists.gnu.org/archive/html/qemu-devel/2020-01/msg05119.html
This series contains the patches I used to debug the problem, and few fixes while manually testing on heterogeneous environments.
Note that I have no idea what virtio/seg_max_adjust is used for, it just happened to broke my Avocado queue while rebasing it on a more recent /master.
Tested on Linux/FreeBSD/OSX, X86/Aarch64.
Regards,
Phil.
Philippe Mathieu-Daudé (6):
tests/acceptance/virtio_seg_max_adjust: Only remove listed machines tests/acceptance/virtio_seg_max_adjust: Improve exception logging tests/acceptance/virtio_seg_max_adjust: List machine being tested tests/acceptance/virtio_seg_max_adjust: Only test Xen as superuser tests/acceptance/virtio_seg_max_adjust: Restrict to X86 architecture tests/acceptance/virtio_seg_max_adjust: Restrict to Linux host
tests/acceptance/virtio_seg_max_adjust.py | 37 +++++++++++++++++++---- 1 file changed, 31 insertions(+), 6 deletions(-)
Signature · 1 line
2.21.1
PATCH 1/6 tests/acceptance/virtio_seg_max_adjust: Only remove listed machines
Do not remove unavailable machines, this fixes:
VirtioMaxSegSettingsCheck.test_machine_types: ERROR: list.remove(x): x not in list (0.12 s)
--- tests/acceptance/virtio_seg_max_adjust.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
tests/acceptance/virtio_seg_max_adjust.py +5 -4
@@ -109,14 +109,15 @@ class VirtioMaxSegSettingsCheck(Test): return False def test_machine_types(self): - # collect all machine types except 'none', 'isapc', 'microvm' + EXCLUDED_MACHINES = ['none', 'isapc', 'microvm'] + # collect all machine types except the ones in EXCLUDED_MACHINES with QEMUMachine(self.qemu_bin) as vm: vm.launch() machines = [m['name'] for m in vm.command('query-machines')] vm.shutdown() - machines.remove('none') - machines.remove('isapc') - machines.remove('microvm') + for m in EXCLUDED_MACHINES: + if m in machines: + machines.remove(m) for dev_type in DEV_TYPES: # create the list of machine types and their parameters.
Signature · 1 line
2.21.1
Re: [PATCH 1/6] tests/acceptance/virtio_seg_max_adjust: Only remove listed machines
Quoted 14 lines · On Wed, 22 Jan 2020 23:32:42 +0100 Philippe Mathieu-Daudé <[email protected]>…
Do not remove unavailable machines, this fixes:
VirtioMaxSegSettingsCheck.test_machine_types: ERROR:
list.remove(x): x not in list (0.12 s)Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)tests/acceptance/virtio_seg_max_adjust.py +0
-0
tests/acceptance/virtio_seg_max_adjust.py class VirtioMaxSegSettingsCheck(Test): · line 112
Quoted 5 lines
tests/acceptance/virtio_seg_max_adjust.py +1
-1@@ -109,14 +109,15 @@ class VirtioMaxSegSettingsCheck(Test): return False def test_machine_types(self): - # collect all machine types except 'none', 'isapc', 'microvm' + EXCLUDED_MACHINES = ['none', 'isapc', 'microvm']
That one seems more flexible as well.
Quoted 4 lines
tests/acceptance/virtio_seg_max_adjust.py +1
-0+ # collect all machine types except the ones in EXCLUDED_MACHINES with QEMUMachine(self.qemu_bin) as vm: vm.launch() machines = [m['name'] for m in vm.command('query-machines')]
tests/acceptance/virtio_seg_max_adjust.py class VirtioMaxSegSettingsCheck(Test): · line 123
Quoted 10 lines
tests/acceptance/virtio_seg_max_adjust.py +3
-3vm.shutdown() - machines.remove('none') - machines.remove('isapc') - machines.remove('microvm') + for m in EXCLUDED_MACHINES: + if m in machines: + machines.remove(m) for dev_type in DEV_TYPES: # create the list of machine types and their parameters.
Re: [PATCH 1/6] tests/acceptance/virtio_seg_max_adjust: Only remove listed machines
In reply to Philippe Mathieu-DaudéHi Philippe,
That fixes one of the problems I mention in another email thread. I was working on a fix, so putting my hands off it. :)
Anyway, see some comments below.
Quoted 14 lines · Philippe Mathieu-Daudé
Do not remove unavailable machines, this fixes:
VirtioMaxSegSettingsCheck.test_machine_types: ERROR:
list.remove(x): x not in list (0.12 s)Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)tests/acceptance/virtio_seg_max_adjust.py +0
-0
tests/acceptance/virtio_seg_max_adjust.py class VirtioMaxSegSettingsCheck(Test): · line 112
Quoted 5 lines
tests/acceptance/virtio_seg_max_adjust.py +1
-1@@ -109,14 +109,15 @@ class VirtioMaxSegSettingsCheck(Test): return False def test_machine_types(self): - # collect all machine types except 'none', 'isapc', 'microvm' + EXCLUDED_MACHINES = ['none', 'isapc', 'microvm']
I was going to suggest moving this constant declaration alongside the others (VIRTIO_SCSI_PROPS, VIRTIO_BLK_PROPS...). But I saw on patch 04 that this variable can get updated, i.e. no longer it is a constant, so I think it could be an object attribute instead. My reasoning is: it is easier to figure out what to change (eventually) if it is an object attribute or module constant.
Also if you want to make it further flexible, you can use Avocado's parameters. Example:
excluded_machines = self.params.get('exclude_machines', default=['none', 'isapc', 'microvm'])
I hope this helps.
- Wainer
Quoted 14 lines
tests/acceptance/virtio_seg_max_adjust.py +4
-3+ # collect all machine types except the ones in EXCLUDED_MACHINES with QEMUMachine(self.qemu_bin) as vm: vm.launch() machines = [m['name'] for m in vm.command('query-machines')] vm.shutdown() - machines.remove('none') - machines.remove('isapc') - machines.remove('microvm') + for m in EXCLUDED_MACHINES: + if m in machines: + machines.remove(m) for dev_type in DEV_TYPES: # create the list of machine types and their parameters.
PATCH 2/6 tests/acceptance/virtio_seg_max_adjust: Improve exception logging
In reply to Philippe Mathieu-Daudé--- tests/acceptance/virtio_seg_max_adjust.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
tests/acceptance/virtio_seg_max_adjust.py +6 -2
@@ -77,8 +77,12 @@ class VirtioMaxSegSettingsCheck(Test): vm.set_machine(mt["name"]) for s in VM_DEV_PARAMS[dev_type_name]: vm.add_args(s) - vm.launch() - query_ok, props, error = self.query_virtqueue(vm, dev_type_name) + try: + vm.launch() + query_ok, props, error = self.query_virtqueue(vm, dev_type_name) + except: + query_ok = False + error = sys.exc_info()[0] if not query_ok: self.fail('machine type {0}: {1}'.format(mt['name'], error))
Signature · 1 line
2.21.1
PATCH 3/6 tests/acceptance/virtio_seg_max_adjust: List machine being tested
In reply to Philippe Mathieu-DaudéAdd logging for easier debugging of failures:
$ avocado --show=machine run tests/acceptance/virtio_seg_max_adjust.py
(1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types:
machine: {'name': 'pc-i440fx-2.12', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
machine: {'name': 'pc-i440fx-2.0', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
machine: {'name': 'pc-q35-4.2', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
machine: {'name': 'pc-i440fx-2.5', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
machine: {'name': 'pc-i440fx-4.2', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
...--- tests/acceptance/virtio_seg_max_adjust.py | 4 ++++ 1 file changed, 4 insertions(+)
tests/acceptance/virtio_seg_max_adjust.py +4 -0
@@ -21,6 +21,7 @@ import sys import os import re +import logging sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine
@@ -73,6 +74,9 @@ class VirtioMaxSegSettingsCheck(Test): return query_ok, props, error def check_mt(self, mt, dev_type_name): + mt['device'] = dev_type_name # Only for the debug() call. + logger = logging.getLogger('machine') + logger.debug(mt) with QEMUMachine(self.qemu_bin) as vm: vm.set_machine(mt["name"]) for s in VM_DEV_PARAMS[dev_type_name]:
Signature · 1 line
2.21.1
PATCH 4/6 tests/acceptance/virtio_seg_max_adjust: Only test Xen as superuser
In reply to Philippe Mathieu-DaudéWhen running the test unprivileged, we get:
$ avocado --show=app,machine run tests/acceptance/virtio_seg_max_adjust.py
JOB ID : b631d5d692e49b791b211d33b80730315d561d45
JOB LOG : job-results/job-2020-01-22T17.56-b631d5d/job.log
(1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types:
machine: {'name': 'pc-i440fx-2.12', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
machine: {'name': 'pc-i440fx-2.0', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
machine: {'name': 'xenpv', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'}
FAIL: machine type xenpv: <class 'qemu.qmp.QMPConnectError'> (0.40 s)Looking at the job.log file we find:
xencall: error: Could not obtain handle on privileged command interface: No such file or directory xen be core: xen be core: can't open xen interface
Do not run this test on Xen machines if not superuser.
--- tests/acceptance/virtio_seg_max_adjust.py | 2 ++ 1 file changed, 2 insertions(+)
tests/acceptance/virtio_seg_max_adjust.py +2 -0
@@ -118,6 +118,8 @@ class VirtioMaxSegSettingsCheck(Test): def test_machine_types(self): EXCLUDED_MACHINES = ['none', '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()
Signature · 1 line
2.21.1
Re: [PATCH 4/6] tests/acceptance/virtio_seg_max_adjust: Only test Xen as superuser
On Wed, 22 Jan 2020 23:32:45 +0100
Philippe Mathieu-Daudé <[email protected]> wrote:
$SUBJECT: s/Only test Xen as superuser/Test Xen only as superuser/ ?
Quoted 28 lines
When running the test unprivileged, we get:
$ avocado --show=app,machine run tests/acceptance/virtio_seg_max_adjust.py JOB ID : b631d5d692e49b791b211d33b80730315d561d45 JOB LOG : job-results/job-2020-01-22T17.56-b631d5d/job.log (1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: machine: {'name': 'pc-i440fx-2.12', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} machine: {'name': 'pc-i440fx-2.0', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} machine: {'name': 'xenpv', 'seg_max_adjust': 'false', 'device': 'virtio-scsi-pci'} FAIL: machine type xenpv: <class 'qemu.qmp.QMPConnectError'> (0.40 s)Looking at the job.log file we find:
xencall: error: Could not obtain handle on privileged command interface: No such file or directory xen be core: xen be core: can't open xen interface
Do not run this test on Xen machines if not superuser.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 2 ++ 1 file changed, 2 insertions(+)tests/acceptance/virtio_seg_max_adjust.py +0
-0
tests/acceptance/virtio_seg_max_adjust.py class VirtioMaxSegSettingsCheck(Test): · line 125
Quoted 8 lines
tests/acceptance/virtio_seg_max_adjust.py +2
-0@@ -118,6 +118,8 @@ class VirtioMaxSegSettingsCheck(Test): def test_machine_types(self): EXCLUDED_MACHINES = ['none', '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()
PATCH 5/6 tests/acceptance/virtio_seg_max_adjust: Restrict to X86 architecture
In reply to Philippe Mathieu-DaudéRunning on mainstream KVM architectures, we get:
- Aarch64
Timeout.
job.log:
-------
No machine specified, and there is no default
Use -machine help to list supported machines
- MIPS:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: argument of type 'NoneType' is not iterable (0.14 s)
job.log:
-------
Could not load MIPS bios 'mipsel_bios.bin', and no -kernel argument was specified
- PowerPC
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for int() with base 10: 'sxxm' (0.16 s)
job.log:
-------
Quoted 1 line
Quoted 1 line
Quoted 1 line
{'execute': 'query-machines'}
<<< {'return': [{'hotpluggable-cpus': True, 'name': 'pseries-2.12-sxxm', 'numa-mem-supported': True, 'default-cpu-type': 'power8_v2.0-powerpc64-cpu', 'cpu-max': 1024, 'deprecated': False}, ...
- S390X:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for int() with base 10: 'virtio' (0.14 s)
job.log:
-------
Traceback (most recent call last):
File "virtio_seg_max_adjust.py", line 139, in test_machine_types
if self.seg_max_adjust_enabled(m):
File "virtio_seg_max_adjust.py", line 113, in seg_max_adjust_enabled
major = int(ver[0])
ValueError: invalid literal for int() with base 10: 'virtio'
Quoted 1 line
Quoted 1 line
Quoted 1 line
{'execute': 'query-machines'}
<<< {'return': [{'hotpluggable-cpus': True, 'name': 's390-ccw-virtio-4.0', 'numa-mem-supported': False, 'default-cpu-type': 'qemu-s390x-cpu', 'cpu-max': 248, 'deprecated': False}, ...
Assuming this test is only expected to run on the X86 architecture, restrict the test to this particular architecture.
When this test is run on other architecture, the tests will be skipped.
Examples:
- running on S390X:
(1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: SKIP: Architecture 's390' unsupported
- running on Aarch64 setting the QEMU binary path:
$ uname -m && avocado --show=app run -p qemu_bin=x86_64-softmmu/qemu-system-x86_64 tests/acceptance/virtio_seg_max_adjust.py aarch64 JOB ID : 92b7fae8868920aada0cb143f9571dffdf60931d JOB LOG : job-results/job-2020-01-22T17.54-92b7fae/job.log (1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: PASS (25.99 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 26.13 s
--- tests/acceptance/virtio_seg_max_adjust.py | 11 +++++++++++ 1 file changed, 11 insertions(+)
tests/acceptance/virtio_seg_max_adjust.py +11 -0
@@ -26,6 +26,7 @@ import logging sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine from avocado_qemu import Test +from avocado.core.exceptions import TestSkipError #list of machine types and virtqueue properties to test VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}
@@ -117,12 +118,22 @@ class VirtioMaxSegSettingsCheck(Test): return False def test_machine_types(self): + """ + :avocado: tags=arch:i386 + :avocado: tags=arch:x86_64 + """ EXCLUDED_MACHINES = ['none', '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() + # Skip test if target is not X86 + # TODO: Move this check to Avocado (based on the test tags) + target_arch = vm.command('query-target')['arch'] + if target_arch not in ['i386', 'x86_64']: + errmsg = "Architecture '%s' unsupported" % target_arch + raise TestSkipError(errmsg) machines = [m['name'] for m in vm.command('query-machines')] vm.shutdown() for m in EXCLUDED_MACHINES:
Signature · 1 line
2.21.1
Re: [PATCH 5/6] tests/acceptance/virtio_seg_max_adjust: Restrict to X86 architecture
Quoted 10 lines · On Wed, 22 Jan 2020 23:32:46 +0100 Philippe Mathieu-Daudé <[email protected]>…
Running on mainstream KVM architectures, we get:
- Aarch64
Timeout.
job.log:
-------
No machine specified, and there is no default
Use -machine help to list supported machines
The code probably needs to be made more clever to find the machines to run?
Quoted 8 lines
- MIPS:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: argument of type 'NoneType' is not iterable (0.14 s)
job.log:
-------
Could not load MIPS bios 'mipsel_bios.bin', and no -kernel argument was specified
Probably needs some hint from mips folks how this can be set up.
Quoted 9 lines
- PowerPC
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for
int()with base 10: 'sxxm' (0.16 s)job.log:
-------Quoted 1 line
Quoted 1 line
Quoted 1 line
{'execute': 'query-machines'}
<<< {'return': [{'hotpluggable-cpus': True, 'name': 'pseries-2.12-sxxm', 'numa-mem-supported': True, 'default-cpu-type': 'power8_v2.0-powerpc64-cpu', 'cpu-max': 1024, 'deprecated': False}, ...
This seems to be because the machine type parsing code cannot deal with the format used here.
Quoted 13 lines
- S390X:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for
int()with base 10: 'virtio' (0.14 s)job.log:
-------
Traceback (most recent call last):
File "virtio_seg_max_adjust.py", line 139, intest_machine_types
ifself.seg_max_adjust_enabled(m):
File "virtio_seg_max_adjust.py", line 113, inseg_max_adjust_enabled
major =int(ver[0])
ValueError: invalid literal forint()with base 10: 'virtio'
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
{'execute': 'query-machines'}
<<< {'return': [{'hotpluggable-cpus': True, 'name': 's390-ccw-virtio-4.0', 'numa-mem-supported': False, 'default-cpu-type': 'qemu-s390x-cpu', 'cpu-max': 248, 'deprecated': False}, ...
Same here.
Quoted 49 lines
Assuming this test is only expected to run on the X86 architecture, restrict the test to this particular architecture.
When this test is run on other architecture, the tests will be skipped.
Examples:
- running on S390X:
(1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: SKIP: Architecture 's390' unsupported
- running on Aarch64 setting the QEMU binary path:
$ uname -m && avocado --show=app run -p qemu_bin=x86_64-softmmu/qemu-system-x86_64 tests/acceptance/virtio_seg_max_adjust.py aarch64 JOB ID : 92b7fae8868920aada0cb143f9571dffdf60931d JOB LOG : job-results/job-2020-01-22T17.54-92b7fae/job.log (1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: PASS (25.99 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 26.13 sSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 11 +++++++++++ 1 file changed, 11 insertions(+)tests/acceptance/virtio_seg_max_adjust.py +5
-0@@ -26,6 +26,7 @@ import logging sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine from avocado_qemu import Test +from avocado.core.exceptions import TestSkipError #list of machine types and virtqueue properties to test VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}@@ -117,12 +118,22 @@ class VirtioMaxSegSettingsCheck(Test): return False def test_machine_types(self): + """ + :avocado: tags=arch:i386 + :avocado: tags=arch:x86_64 + """ EXCLUDED_MACHINES = ['none', 'isapc', 'microvm'] if os.geteuid() != 0:
tests/acceptance/virtio_seg_max_adjust.py class VirtioMaxSegSettingsCheck(Test): · line 136
Quoted 10 lines
tests/acceptance/virtio_seg_max_adjust.py +6
-0EXCLUDED_MACHINES += ['xenfv', 'xenpv'] # collect all machine types except the ones in EXCLUDED_MACHINES with QEMUMachine(self.qemu_bin) as vm: vm.launch() + # Skip test if target is not X86 + # TODO: Move this check to Avocado (based on the test tags) + target_arch = vm.command('query-target')['arch'] + if target_arch not in ['i386', 'x86_64']: + errmsg = "Architecture '%s' unsupported" % target_arch + raise TestSkipError(errmsg)
I think we should rather fix the machine parsing code, and only then exclude architectures out of the box. (Sorry, my python-fu is lacking, or I would try it myself.)
There does not seem to be anything that is really architecture specific in there. Just explicitly requesting the -pci versions of virtio-blk and virtio-scsi seems wrong, though, as this looks like a generic property, and should work on -ccw as well. (And probably also for virtio-mmio devices.) If not, I'd like to know :)
Quoted 3 lines
tests/acceptance/virtio_seg_max_adjust.py +0
-0machines = [m['name'] for m in vm.command('query-machines')] vm.shutdown() for m in EXCLUDED_MACHINES:
Re: [PATCH 5/6] tests/acceptance/virtio_seg_max_adjust: Restrict to X86 architecture
Quoted 27 lines · Cornelia Huck
Quoted 10 lines · On Wed, 22 Jan 2020 23:32:46 +0100 Philippe Mathieu-Daudé <[email protected]>…
Running on mainstream KVM architectures, we get:
- Aarch64
Timeout.
job.log:
-------
No machine specified, and there is no default
Use -machine help to list supported machinesThe code probably needs to be made more clever to find the machines to run?
Quoted 7 lines
- MIPS:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: argument of type 'NoneType' is not iterable (0.14 s)
job.log:
-------
Could not load MIPS bios 'mipsel_bios.bin', and no -kernel argument was specifiedProbably needs some hint from mips folks how this can be set up.
Quoted 2 lines
- PowerPC
Quoted 8 lines
Quoted 6 lines
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for
int()with base 10: 'sxxm' (0.16 s)job.log: ------- >>> {'execute': 'query-machines'} <<< {'return': [{'hotpluggable-cpus': True, 'name': 'pseries-2.12-sxxm', 'numa-mem-supported': True, 'default-cpu-type': 'power8_v2.0-powerpc64-cpu', 'cpu-max': 1024, 'deprecated': False}, ...This seems to be because the machine type parsing code cannot deal with the format used here.
Indeed, looking at the comments in code the parser was meant for PC types.
Is there a way to obtain the machine type version other than parsing its name? If not, wouldn't be useful for management apps have that information returned with 'query-machines'?
- Wainer
Quoted 88 lines
Quoted 12 lines
- S390X:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for
int()with base 10: 'virtio' (0.14 s)job.log:
-------
Traceback (most recent call last):
File "virtio_seg_max_adjust.py", line 139, intest_machine_types
ifself.seg_max_adjust_enabled(m):
File "virtio_seg_max_adjust.py", line 113, inseg_max_adjust_enabled
major =int(ver[0])
ValueError: invalid literal forint()with base 10: 'virtio'Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
{'execute': 'query-machines'}
<<< {'return': [{'hotpluggable-cpus': True, 'name': 's390-ccw-virtio-4.0', 'numa-mem-supported': False, 'default-cpu-type': 'qemu-s390x-cpu', 'cpu-max': 248, 'deprecated': False}, ...
Same here.
Quoted 48 lines
Assuming this test is only expected to run on the X86 architecture, restrict the test to this particular architecture.
When this test is run on other architecture, the tests will be skipped.
Examples:
- running on S390X:
(1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: SKIP: Architecture 's390' unsupported
- running on Aarch64 setting the QEMU binary path:
$ uname -m && avocado --show=app run -p qemu_bin=x86_64-softmmu/qemu-system-x86_64 tests/acceptance/virtio_seg_max_adjust.py aarch64 JOB ID : 92b7fae8868920aada0cb143f9571dffdf60931d JOB LOG : job-results/job-2020-01-22T17.54-92b7fae/job.log (1/1) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: PASS (25.99 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 26.13 sSigned-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 11 +++++++++++ 1 file changed, 11 insertions(+)tests/acceptance/virtio_seg_max_adjust.py +5
-0@@ -26,6 +26,7 @@ import logging sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine from avocado_qemu import Test +from avocado.core.exceptions import TestSkipError #list of machine types and virtqueue properties to test VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}@@ -117,12 +118,22 @@ class VirtioMaxSegSettingsCheck(Test): return False def test_machine_types(self): + """ + :avocado: tags=arch:i386 + :avocado: tags=arch:x86_64 + """ EXCLUDED_MACHINES = ['none', 'isapc', 'microvm'] if os.geteuid() != 0:tests/acceptance/virtio_seg_max_adjust.py class VirtioMaxSegSettingsCheck(Test): · line 136
Quoted 10 lines
tests/acceptance/virtio_seg_max_adjust.py +6
-0EXCLUDED_MACHINES += ['xenfv', 'xenpv'] # collect all machine types except the ones in EXCLUDED_MACHINES with QEMUMachine(self.qemu_bin) as vm: vm.launch() + # Skip test if target is not X86 + # TODO: Move this check to Avocado (based on the test tags) + target_arch = vm.command('query-target')['arch'] + if target_arch not in ['i386', 'x86_64']: + errmsg = "Architecture '%s' unsupported" % target_arch + raise TestSkipError(errmsg)I think we should rather fix the machine parsing code, and only then exclude architectures out of the box. (Sorry, my python-fu is lacking, or I would try it myself.)
There does not seem to be anything that is really architecture specific in there. Just explicitly requesting the -pci versions of virtio-blk and virtio-scsi seems wrong, though, as this looks like a generic property, and should work on -ccw as well. (And probably also for virtio-mmio devices.) If not, I'd like to know :)
Quoted 3 lines
tests/acceptance/virtio_seg_max_adjust.py +0
-0machines = [m['name'] for m in vm.command('query-machines')] vm.shutdown() for m in EXCLUDED_MACHINES:
Re: [PATCH 5/6] tests/acceptance/virtio_seg_max_adjust: Restrict to X86 architecture
Quoted 38 lines · On Thu, 23 Jan 2020 11:36:55 -0200 Wainer dos Santos Moschetta…
Quoted 27 lines · Cornelia Huck
Quoted 10 lines · On Wed, 22 Jan 2020 23:32:46 +0100 Philippe Mathieu-Daudé <[email protected]>…
Running on mainstream KVM architectures, we get:
- Aarch64
Timeout.
job.log:
-------
No machine specified, and there is no default
Use -machine help to list supported machinesThe code probably needs to be made more clever to find the machines to run?
Quoted 7 lines
- MIPS:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: argument of type 'NoneType' is not iterable (0.14 s)
job.log:
-------
Could not load MIPS bios 'mipsel_bios.bin', and no -kernel argument was specifiedProbably needs some hint from mips folks how this can be set up.
Quoted 2 lines
- PowerPC
Quoted 8 lines
Quoted 6 lines
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for
int()with base 10: 'sxxm' (0.16 s)job.log: ------- >>> {'execute': 'query-machines'} <<< {'return': [{'hotpluggable-cpus': True, 'name': 'pseries-2.12-sxxm', 'numa-mem-supported': True, 'default-cpu-type': 'power8_v2.0-powerpc64-cpu', 'cpu-max': 1024, 'deprecated': False}, ...This seems to be because the machine type parsing code cannot deal with the format used here.
Quoted 5 lines
Indeed, looking at the comments in code the parser was meant for PC types.
Is there a way to obtain the machine type version other than parsing its name? If not, wouldn't be useful for management apps have that information returned with 'query-machines'?
The question would be "What version?". The pseries machine type the code chokes upon above has an additional suffix. Not all machine types are versioned, obviously, and we don't have an uniform way to build machine type names, either.
If I understand this test correctly, the idea is to distinguish between "version that defaults the feature to off" and "version that defaults the feature to on". So, the pseries machine with the extra suffix from above and the one without would basically be the same 2.12 compatible machine (both in the first bucket). For other tests, those two machines might be very different, though.
tl;dr "version" might not be well-defined enough.
Quoted 18 lines
- Wainer
Quoted 15 lines
Quoted 12 lines
- S390X:
(1/1) VirtioMaxSegSettingsCheck.test_machine_types: ERROR: invalid literal for
int()with base 10: 'virtio' (0.14 s)job.log:
-------
Traceback (most recent call last):
File "virtio_seg_max_adjust.py", line 139, intest_machine_types
ifself.seg_max_adjust_enabled(m):
File "virtio_seg_max_adjust.py", line 113, inseg_max_adjust_enabled
major =int(ver[0])
ValueError: invalid literal forint()with base 10: 'virtio'Quoted 2 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
{'execute': 'query-machines'}
<<< {'return': [{'hotpluggable-cpus': True, 'name': 's390-ccw-virtio-4.0', 'numa-mem-supported': False, 'default-cpu-type': 'qemu-s390x-cpu', 'cpu-max': 248, 'deprecated': False}, ...
Same here.
PATCH 6/6 tests/acceptance/virtio_seg_max_adjust: Restrict to Linux host
In reply to Philippe Mathieu-DaudéThis test is failing on OSX:
TestFail: machine type pc-i440fx-2.0: <class 'TypeError'>
Looking at the job.log:
Unexpected error in object_property_find() at qom/object.c:1201:
qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not found
Which makes sense looking at hw/block/virtio-blk.c:
1261 static Property virtio_blk_properties[] = {
1262 DEFINE_BLOCK_PROPERTIES(VirtIOBlock, conf.conf),
...
1268 #ifdef __linux__
1269 DEFINE_PROP_BIT64("scsi", VirtIOBlock, host_features,
1270 VIRTIO_BLK_F_SCSI, false),
1271 #endif
Fix by only running this test on a Linux host:
(38/55) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: SKIP: Host OS is not Linux
--- tests/acceptance/virtio_seg_max_adjust.py | 3 +++ 1 file changed, 3 insertions(+)
tests/acceptance/virtio_seg_max_adjust.py +3 -0
@@ -27,6 +27,7 @@ sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python')) from qemu.machine import QEMUMachine from avocado_qemu import Test from avocado.core.exceptions import TestSkipError +from avocado import skipUnless #list of machine types and virtqueue properties to test VIRTIO_SCSI_PROPS = {'seg_max_adjust': 'seg_max_adjust'}
@@ -117,6 +118,8 @@ class VirtioMaxSegSettingsCheck(Test): return True return False + + @skipUnless(sys.platform.startswith('linux'), 'Host OS is not Linux') def test_machine_types(self): """ :avocado: tags=arch:i386
Signature · 1 line
2.21.1
Re: [PATCH 6/6] tests/acceptance/virtio_seg_max_adjust: Restrict to Linux host
Quoted 19 lines · On Wed, 22 Jan 2020 23:32:47 +0100 Philippe Mathieu-Daudé <[email protected]>…
This test is failing on OSX:
TestFail: machine type pc-i440fx-2.0: <class 'TypeError'>
Looking at the job.log:
Unexpected error in
object_property_find()atqom/object.c:1201:
qemu-system-x86_64: -device virtio-blk-pci,id=scsi0,drive=drive0: can't apply global virtio-blk-device.scsi=true: Property '.scsi' not foundWhich makes sense looking at
hw/block/virtio-blk.c:1261 static Property virtio_blk_properties[] = {
1262DEFINE_BLOCK_PROPERTIES(VirtIOBlock, conf.conf),
...
1268 #ifdef__linux__
1269 DEFINE_PROP_BIT64("scsi", VirtIOBlock,host_features,
1270VIRTIO_BLK_F_SCSI, false),
1271 #endif
Quoted 3 lines
Fix by only running this test on a Linux host:
(38/55) tests/acceptance/virtio_seg_max_adjust.py:VirtioMaxSegSettingsCheck.test_machine_types: SKIP: Host OS is not Linux
Does this work with the change I proposed in the other thread? If it does, I'd prefer to send a proper fix for that. (Well, I'd prefer to fix it regardless.)
Or is there other Linux-specific stuff in there? Does not look like it at a glance, we were just bitten by the unrelated scsi property thing.
Quoted 5 lines
Signed-off-by Philippe Mathieu-Daudé <[email protected]>--- tests/acceptance/virtio_seg_max_adjust.py | 3 +++ 1 file changed, 3 insertions(+)