aboutsummaryrefslogtreecommitdiff
path: root/tests/drive_del-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/drive_del-test.c')
-rw-r--r--tests/drive_del-test.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c
index 2175139abb..c9ac997555 100644
--- a/tests/drive_del-test.c
+++ b/tests/drive_del-test.c
@@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "libqtest.h"
+#include "libqos/virtio.h"
static void drive_add(void)
{
@@ -65,14 +66,14 @@ static void test_after_failed_device_add(void)
qtest_start("-drive if=none,id=drive0");
- /* Make device_add fail. If this leaks the virtio-blk-pci device then a
+ /* Make device_add fail. If this leaks the virtio-blk device then a
* reference to drive0 will also be held (via qdev properties).
*/
response = qmp("{'execute': 'device_add',"
" 'arguments': {"
- " 'driver': 'virtio-blk-pci',"
+ " 'driver': 'virtio-blk-%s',"
" 'drive': 'drive0'"
- "}}");
+ "}}", qvirtio_get_dev_type());
g_assert(response);
error = qdict_get_qdict(response, "error");
g_assert_cmpstr(qdict_get_try_str(error, "class"), ==, "GenericError");
@@ -82,7 +83,7 @@ static void test_after_failed_device_add(void)
drive_del();
/* Try to re-add the drive. This fails with duplicate IDs if a leaked
- * virtio-blk-pci exists that holds a reference to the old drive0.
+ * virtio-blk device exists that holds a reference to the old drive0.
*/
drive_add();
@@ -91,10 +92,14 @@ static void test_after_failed_device_add(void)
static void test_drive_del_device_del(void)
{
+ char *args;
+
/* Start with a drive used by a device that unplugs instantaneously */
- qtest_start("-drive if=none,id=drive0,file=null-co://,format=raw"
- " -device virtio-scsi-pci"
- " -device scsi-hd,drive=drive0,id=dev0");
+ args = g_strdup_printf("-drive if=none,id=drive0,file=null-co://,format=raw"
+ " -device virtio-scsi-%s"
+ " -device scsi-hd,drive=drive0,id=dev0",
+ qvirtio_get_dev_type());
+ qtest_start(args);
/*
* Delete the drive, and then the device
@@ -104,6 +109,7 @@ static void test_drive_del_device_del(void)
device_del();
qtest_end();
+ g_free(args);
}
int main(int argc, char **argv)
@@ -114,9 +120,10 @@ int main(int argc, char **argv)
qtest_add_func("/drive_del/without-dev", test_drive_without_dev);
- /* TODO I guess any arch with PCI would do */
+ /* TODO I guess any arch with a hot-pluggable virtio bus would do */
if (!strcmp(arch, "i386") || !strcmp(arch, "x86_64") ||
- !strcmp(arch, "ppc") || !strcmp(arch, "ppc64")) {
+ !strcmp(arch, "ppc") || !strcmp(arch, "ppc64") ||
+ !strcmp(arch, "s390x")) {
qtest_add_func("/drive_del/after_failed_device_add",
test_after_failed_device_add);
qtest_add_func("/blockdev/drive_del_device_del",