summaryrefslogtreecommitdiff
path: root/tests/libqos
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2017-08-31 16:40:08 +0200
committerCornelia Huck <cohuck@redhat.com>2017-09-19 18:21:32 +0200
commit2f84a92ec631f5907207990705a22afb9aad3eef (patch)
tree7aa72d5b476b59c580c1d41feb6b3824caaf3aef /tests/libqos
parent6c86462220a1c7f5d673663d31d297627a2868a6 (diff)
downloadqemu-2f84a92ec631f5907207990705a22afb9aad3eef.tar.gz
tests: Enable the drive_del test also on s390x
We can use the drive_del test on s390x, too, to check that adding and deleting also works fine with the virtio-ccw bus. But we have to make sure that we use the devices with the "-ccw" suffix instead of the "-pci" suffix for the virtio-ccw transport on s390x. Introduce a helper function called qvirtio_get_dev_type() that returns the correct string for the current architecture. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-Id: <1504190408-11143-1-git-send-email-thuth@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'tests/libqos')
-rw-r--r--tests/libqos/virtio.c17
-rw-r--r--tests/libqos/virtio.h3
2 files changed, 20 insertions, 0 deletions
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index 9880a6964e..0879a621c8 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -339,3 +339,20 @@ void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx)
/* vq->avail->used_event */
writew(vq->avail + 4 + (2 * vq->size), idx);
}
+
+/*
+ * qvirtio_get_dev_type:
+ * Returns: the preferred virtio bus/device type for the current architecture.
+ */
+const char *qvirtio_get_dev_type(void)
+{
+ const char *arch = qtest_get_arch();
+
+ if (g_str_equal(arch, "arm") || g_str_equal(arch, "aarch64")) {
+ return "device"; /* for virtio-mmio */
+ } else if (g_str_equal(arch, "s390x")) {
+ return "ccw";
+ } else {
+ return "pci";
+ }
+}
diff --git a/tests/libqos/virtio.h b/tests/libqos/virtio.h
index 8fbcd1869c..0a04740adf 100644
--- a/tests/libqos/virtio.h
+++ b/tests/libqos/virtio.h
@@ -143,4 +143,7 @@ void qvirtqueue_kick(QVirtioDevice *d, QVirtQueue *vq, uint32_t free_head);
bool qvirtqueue_get_buf(QVirtQueue *vq, uint32_t *desc_idx);
void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx);
+
+const char *qvirtio_get_dev_type(void);
+
#endif