summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJohn Snow2019-07-29 22:35:54 +0200
committerJohn Snow2019-08-16 22:28:02 +0200
commitf357576fa9cfc6413a9629145dbe2e56a11d7e0d (patch)
tree4b705782fc1f2f76d6568ea0ce5b34f6a77ec384 /tests
parentiotests: teach FilePath to produce multiple paths (diff)
downloadqemu-f357576fa9cfc6413a9629145dbe2e56a11d7e0d.tar.gz
qemu-f357576fa9cfc6413a9629145dbe2e56a11d7e0d.tar.xz
qemu-f357576fa9cfc6413a9629145dbe2e56a11d7e0d.zip
iotests: Add virtio-scsi device helper
Seems that it comes up enough. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 20190709232550.10724-17-jsnow@redhat.com Signed-off-by: John Snow <jsnow@redhat.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/qemu-iotests/0406
-rwxr-xr-xtests/qemu-iotests/0936
-rwxr-xr-xtests/qemu-iotests/1397
-rwxr-xr-xtests/qemu-iotests/2385
-rw-r--r--tests/qemu-iotests/iotests.py4
5 files changed, 10 insertions, 18 deletions
diff --git a/tests/qemu-iotests/040 b/tests/qemu-iotests/040
index aa0b1847e3..6db9abf8e6 100755
--- a/tests/qemu-iotests/040
+++ b/tests/qemu-iotests/040
@@ -85,11 +85,7 @@ class TestSingleDrive(ImageCommitTestCase):
qemu_io('-f', 'raw', '-c', 'write -P 0xab 0 524288', backing_img)
qemu_io('-f', iotests.imgfmt, '-c', 'write -P 0xef 524288 524288', mid_img)
self.vm = iotests.VM().add_drive(test_img, "node-name=top,backing.node-name=mid,backing.backing.node-name=base", interface="none")
- if iotests.qemu_default_machine == 's390-ccw-virtio':
- self.vm.add_device("virtio-scsi-ccw")
- else:
- self.vm.add_device("virtio-scsi-pci")
-
+ self.vm.add_device(iotests.get_virtio_scsi_device())
self.vm.add_device("scsi-hd,id=scsi0,drive=drive0")
self.vm.launch()
self.has_quit = False
diff --git a/tests/qemu-iotests/093 b/tests/qemu-iotests/093
index 4b2cac1d0c..3c4f5173ce 100755
--- a/tests/qemu-iotests/093
+++ b/tests/qemu-iotests/093
@@ -367,10 +367,8 @@ class ThrottleTestGroupNames(iotests.QMPTestCase):
class ThrottleTestRemovableMedia(iotests.QMPTestCase):
def setUp(self):
self.vm = iotests.VM()
- if iotests.qemu_default_machine == 's390-ccw-virtio':
- self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi")
- else:
- self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
+ self.vm.add_device("{},id=virtio-scsi".format(
+ iotests.get_virtio_scsi_device()))
self.vm.launch()
def tearDown(self):
diff --git a/tests/qemu-iotests/139 b/tests/qemu-iotests/139
index 933b45121a..2176ea51ba 100755
--- a/tests/qemu-iotests/139
+++ b/tests/qemu-iotests/139
@@ -35,11 +35,8 @@ class TestBlockdevDel(iotests.QMPTestCase):
def setUp(self):
iotests.qemu_img('create', '-f', iotests.imgfmt, base_img, '1M')
self.vm = iotests.VM()
- if iotests.qemu_default_machine == 's390-ccw-virtio':
- self.vm.add_device("virtio-scsi-ccw,id=virtio-scsi")
- else:
- self.vm.add_device("virtio-scsi-pci,id=virtio-scsi")
-
+ self.vm.add_device("{},id=virtio-scsi".format(
+ iotests.get_virtio_scsi_device()))
self.vm.launch()
def tearDown(self):
diff --git a/tests/qemu-iotests/238 b/tests/qemu-iotests/238
index 08bc7e6b4b..e5ac2b2ff8 100755
--- a/tests/qemu-iotests/238
+++ b/tests/qemu-iotests/238
@@ -23,10 +23,7 @@ import os
import iotests
from iotests import log
-if iotests.qemu_default_machine == 's390-ccw-virtio':
- virtio_scsi_device = 'virtio-scsi-ccw'
-else:
- virtio_scsi_device = 'virtio-scsi-pci'
+virtio_scsi_device = iotests.get_virtio_scsi_device()
vm = iotests.VM()
vm.launch()
diff --git a/tests/qemu-iotests/iotests.py b/tests/qemu-iotests/iotests.py
index 385dbad16a..84438e837c 100644
--- a/tests/qemu-iotests/iotests.py
+++ b/tests/qemu-iotests/iotests.py
@@ -164,6 +164,10 @@ def qemu_io_silent(*args):
(-exitcode, ' '.join(args)))
return exitcode
+def get_virtio_scsi_device():
+ if qemu_default_machine == 's390-ccw-virtio':
+ return 'virtio-scsi-ccw'
+ return 'virtio-scsi-pci'
class QemuIoInteractive:
def __init__(self, *args):