Message ID | 20210319132537.2046339-7-laurent@vivier.eu |
---|---|
State | New |
Headers | show |
Series | iotests: fix failures with non-PCI machines | expand |
On 3/19/21 2:25 PM, Laurent Vivier wrote: > And ioeventfd are only available with virtio-scsi-pci or virtio-scsi-ccw, > use the alias but add a rule to require virtio-scsi-pci or virtio-scsi-ccw > for the tests that use iothreads. > > Signed-off-by: Laurent Vivier <laurent@vivier.eu> > --- > tests/qemu-iotests/127 | 3 ++- > tests/qemu-iotests/256 | 6 ++++-- > tests/qemu-iotests/iotests.py | 5 +++++ > 3 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127 > index 98e8e82a8210..abe24861100d 100755 > --- a/tests/qemu-iotests/127 > +++ b/tests/qemu-iotests/127 > @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > _supported_fmt qcow2 > _supported_proto file fuse > > -_require_devices virtio-scsi scsi-hd > +_require_devices scsi-hd > +_require_devices virtio-scsi-pci || _require_devices virtio-scsi-ccw > > IMG_SIZE=64K > > diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256 > index 8d82a1dd865f..13666813bd8f 100755 > --- a/tests/qemu-iotests/256 > +++ b/tests/qemu-iotests/256 > @@ -24,6 +24,8 @@ import os > import iotests > from iotests import log > > +iotests._verify_virtio_scsi_pci_or_ccw() > + > iotests.script_initialize(supported_fmts=['qcow2']) > size = 64 * 1024 * 1024 > > @@ -61,8 +63,8 @@ with iotests.FilePath('img0') as img0_path, \ > log('--- Preparing images & VM ---\n') > vm.add_object('iothread,id=iothread0') > vm.add_object('iothread,id=iothread1') > - vm.add_device('virtio-scsi-pci,id=scsi0,iothread=iothread0') > - vm.add_device('virtio-scsi-pci,id=scsi1,iothread=iothread1') > + vm.add_device('virtio-scsi,id=scsi0,iothread=iothread0') > + vm.add_device('virtio-scsi,id=scsi1,iothread=iothread1') > iotests.qemu_img_create('-f', iotests.imgfmt, img0_path, str(size)) > iotests.qemu_img_create('-f', iotests.imgfmt, img1_path, str(size)) > vm.add_drive(img0_path, interface='none') > diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py > index 1e9e6a066e90..d3faf96005dd 100644 > --- a/tests/qemu-iotests/iotests.py > +++ b/tests/qemu-iotests/iotests.py > @@ -1146,6 +1146,11 @@ def _verify_virtio_blk() -> None: > if 'virtio-blk' not in out: > notrun('Missing virtio-blk in QEMU binary') > > +def _verify_virtio_scsi_pci_or_ccw() -> None: > + out = qemu_pipe('-M', 'none', '-device', 'help') > + if 'virtio-scsi-pci' not in out and 'virtio-scsi-ccw' not in out: ^ "and" is OK > + notrun('Missing virtio-scsi-pci and virtio-scsi-ccw in QEMU binary') ^ here "and" -> "or"? > + > > def supports_quorum(): > return 'quorum' in qemu_img_pipe('--help') >
Le 19/03/2021 à 14:36, Philippe Mathieu-Daudé a écrit : > On 3/19/21 2:25 PM, Laurent Vivier wrote: >> And ioeventfd are only available with virtio-scsi-pci or virtio-scsi-ccw, >> use the alias but add a rule to require virtio-scsi-pci or virtio-scsi-ccw >> for the tests that use iothreads. >> >> Signed-off-by: Laurent Vivier <laurent@vivier.eu> >> --- >> tests/qemu-iotests/127 | 3 ++- >> tests/qemu-iotests/256 | 6 ++++-- >> tests/qemu-iotests/iotests.py | 5 +++++ >> 3 files changed, 11 insertions(+), 3 deletions(-) >> >> diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127 >> index 98e8e82a8210..abe24861100d 100755 >> --- a/tests/qemu-iotests/127 >> +++ b/tests/qemu-iotests/127 >> @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 >> _supported_fmt qcow2 >> _supported_proto file fuse >> >> -_require_devices virtio-scsi scsi-hd >> +_require_devices scsi-hd >> +_require_devices virtio-scsi-pci || _require_devices virtio-scsi-ccw Re-reading the code, I think this cannot work because we have an "exit" if the test fails. The test is executed anyway because s390x provides virtio-scsi-ccw and virtio-scsi-pci. Thanks, Laurent
On Fri, 19 Mar 2021 14:51:59 +0100 Laurent Vivier <laurent@vivier.eu> wrote: > Le 19/03/2021 à 14:36, Philippe Mathieu-Daudé a écrit : > > On 3/19/21 2:25 PM, Laurent Vivier wrote: > >> And ioeventfd are only available with virtio-scsi-pci or virtio-scsi-ccw, > >> use the alias but add a rule to require virtio-scsi-pci or virtio-scsi-ccw > >> for the tests that use iothreads. > >> > >> Signed-off-by: Laurent Vivier <laurent@vivier.eu> > >> --- > >> tests/qemu-iotests/127 | 3 ++- > >> tests/qemu-iotests/256 | 6 ++++-- > >> tests/qemu-iotests/iotests.py | 5 +++++ > >> 3 files changed, 11 insertions(+), 3 deletions(-) > >> > >> diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127 > >> index 98e8e82a8210..abe24861100d 100755 > >> --- a/tests/qemu-iotests/127 > >> +++ b/tests/qemu-iotests/127 > >> @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > >> _supported_fmt qcow2 > >> _supported_proto file fuse > >> > >> -_require_devices virtio-scsi scsi-hd > >> +_require_devices scsi-hd > >> +_require_devices virtio-scsi-pci || _require_devices virtio-scsi-ccw > > Re-reading the code, I think this cannot work because we have an "exit" if the test fails. We could try to make _require_devices accept alternatives, but that is probably overkill... > > The test is executed anyway because s390x provides virtio-scsi-ccw and virtio-scsi-pci. ...because of this. Maybe just add a comment that we require pci or ccw because iothreads depend on ioventfd, but checking for pci is enough, as we have pci when we have ccw? > > Thanks, > Laurent >
Le 19/03/2021 à 15:23, Cornelia Huck a écrit : > On Fri, 19 Mar 2021 14:51:59 +0100 > Laurent Vivier <laurent@vivier.eu> wrote: > >> Le 19/03/2021 à 14:36, Philippe Mathieu-Daudé a écrit : >>> On 3/19/21 2:25 PM, Laurent Vivier wrote: >>>> And ioeventfd are only available with virtio-scsi-pci or virtio-scsi-ccw, >>>> use the alias but add a rule to require virtio-scsi-pci or virtio-scsi-ccw >>>> for the tests that use iothreads. >>>> >>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu> >>>> --- >>>> tests/qemu-iotests/127 | 3 ++- >>>> tests/qemu-iotests/256 | 6 ++++-- >>>> tests/qemu-iotests/iotests.py | 5 +++++ >>>> 3 files changed, 11 insertions(+), 3 deletions(-) >>>> >>>> diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127 >>>> index 98e8e82a8210..abe24861100d 100755 >>>> --- a/tests/qemu-iotests/127 >>>> +++ b/tests/qemu-iotests/127 >>>> @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 >>>> _supported_fmt qcow2 >>>> _supported_proto file fuse >>>> >>>> -_require_devices virtio-scsi scsi-hd >>>> +_require_devices scsi-hd >>>> +_require_devices virtio-scsi-pci || _require_devices virtio-scsi-ccw >> >> Re-reading the code, I think this cannot work because we have an "exit" if the test fails. > > We could try to make _require_devices accept alternatives, but that is > probably overkill... > >> >> The test is executed anyway because s390x provides virtio-scsi-ccw and virtio-scsi-pci. > > ...because of this. > > Maybe just add a comment that we require pci or ccw because iothreads > depend on ioventfd, but checking for pci is enough, as we have pci when > we have ccw? > Well... bash is fun: _require_one_device_of() { available=$($QEMU -M none -device help | \ grep ^name | sed -e 's/^name "//' -e 's/".*$//') for device do if echo "$available" | grep -q "$device" ; then return fi done _notrun "$* not available" } and: _require_one_device_of virtio-scsi-pci virtio-scsi-ccw Thanks, Laurent
On Fri, 19 Mar 2021 15:27:24 +0100 Laurent Vivier <laurent@vivier.eu> wrote: > Le 19/03/2021 à 15:23, Cornelia Huck a écrit : > > On Fri, 19 Mar 2021 14:51:59 +0100 > > Laurent Vivier <laurent@vivier.eu> wrote: > > > >> Le 19/03/2021 à 14:36, Philippe Mathieu-Daudé a écrit : > >>> On 3/19/21 2:25 PM, Laurent Vivier wrote: > >>>> And ioeventfd are only available with virtio-scsi-pci or virtio-scsi-ccw, > >>>> use the alias but add a rule to require virtio-scsi-pci or virtio-scsi-ccw > >>>> for the tests that use iothreads. > >>>> > >>>> Signed-off-by: Laurent Vivier <laurent@vivier.eu> > >>>> --- > >>>> tests/qemu-iotests/127 | 3 ++- > >>>> tests/qemu-iotests/256 | 6 ++++-- > >>>> tests/qemu-iotests/iotests.py | 5 +++++ > >>>> 3 files changed, 11 insertions(+), 3 deletions(-) > >>>> > >>>> diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127 > >>>> index 98e8e82a8210..abe24861100d 100755 > >>>> --- a/tests/qemu-iotests/127 > >>>> +++ b/tests/qemu-iotests/127 > >>>> @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 > >>>> _supported_fmt qcow2 > >>>> _supported_proto file fuse > >>>> > >>>> -_require_devices virtio-scsi scsi-hd > >>>> +_require_devices scsi-hd > >>>> +_require_devices virtio-scsi-pci || _require_devices virtio-scsi-ccw > >> > >> Re-reading the code, I think this cannot work because we have an "exit" if the test fails. > > > > We could try to make _require_devices accept alternatives, but that is > > probably overkill... > > > >> > >> The test is executed anyway because s390x provides virtio-scsi-ccw and virtio-scsi-pci. > > > > ...because of this. > > > > Maybe just add a comment that we require pci or ccw because iothreads > > depend on ioventfd, but checking for pci is enough, as we have pci when > > we have ccw? > > > > Well... bash is fun: > > _require_one_device_of() > { > available=$($QEMU -M none -device help | \ > grep ^name | sed -e 's/^name "//' -e 's/".*$//') > for device > do > if echo "$available" | grep -q "$device" ; then > return > fi > done > _notrun "$* not available" > } > > and: > > _require_one_device_of virtio-scsi-pci virtio-scsi-ccw > > Thanks, > Laurent > Even better :)
diff --git a/tests/qemu-iotests/127 b/tests/qemu-iotests/127 index 98e8e82a8210..abe24861100d 100755 --- a/tests/qemu-iotests/127 +++ b/tests/qemu-iotests/127 @@ -44,7 +44,8 @@ trap "_cleanup; exit \$status" 0 1 2 3 15 _supported_fmt qcow2 _supported_proto file fuse -_require_devices virtio-scsi scsi-hd +_require_devices scsi-hd +_require_devices virtio-scsi-pci || _require_devices virtio-scsi-ccw IMG_SIZE=64K diff --git a/tests/qemu-iotests/256 b/tests/qemu-iotests/256 index 8d82a1dd865f..13666813bd8f 100755 --- a/tests/qemu-iotests/256 +++ b/tests/qemu-iotests/256 @@ -24,6 +24,8 @@ import os import iotests from iotests import log +iotests._verify_virtio_scsi_pci_or_ccw() + iotests.script_initialize(supported_fmts=['qcow2']) size = 64 * 1024 * 1024 @@ -61,8 +63,8 @@ with iotests.FilePath('img0') as img0_path, \ log('--- Preparing images & VM ---\n') vm.add_object('iothread,id=iothread0') vm.add_object('iothread,id=iothread1') - vm.add_device('virtio-scsi-pci,id=scsi0,iothread=iothread0') - vm.add_device('virtio-scsi-pci,id=scsi1,iothread=iothread1') + vm.add_device('virtio-scsi,id=scsi0,iothread=iothread0') + vm.add_device('virtio-scsi,id=scsi1,iothread=iothread1') iotests.qemu_img_create('-f', iotests.imgfmt, img0_path, str(size)) iotests.qemu_img_create('-f', iotests.imgfmt, img1_path, str(size)) vm.add_drive(img0_path, interface='none') diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py index 1e9e6a066e90..d3faf96005dd 100644 --- a/tests/qemu-iotests/iotests.py +++ b/tests/qemu-iotests/iotests.py @@ -1146,6 +1146,11 @@ def _verify_virtio_blk() -> None: if 'virtio-blk' not in out: notrun('Missing virtio-blk in QEMU binary') +def _verify_virtio_scsi_pci_or_ccw() -> None: + out = qemu_pipe('-M', 'none', '-device', 'help') + if 'virtio-scsi-pci' not in out and 'virtio-scsi-ccw' not in out: + notrun('Missing virtio-scsi-pci and virtio-scsi-ccw in QEMU binary') + def supports_quorum(): return 'quorum' in qemu_img_pipe('--help')
And ioeventfd are only available with virtio-scsi-pci or virtio-scsi-ccw, use the alias but add a rule to require virtio-scsi-pci or virtio-scsi-ccw for the tests that use iothreads. Signed-off-by: Laurent Vivier <laurent@vivier.eu> --- tests/qemu-iotests/127 | 3 ++- tests/qemu-iotests/256 | 6 ++++-- tests/qemu-iotests/iotests.py | 5 +++++ 3 files changed, 11 insertions(+), 3 deletions(-)