aboutsummaryrefslogtreecommitdiff
path: root/tests/drive_del-test.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-10-05 15:02:44 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2019-03-07 17:28:45 +0100
commit19e3d9795c62fa5d91977af45ec8fad5984d874d (patch)
tree9b689072dc212a493c6134a07f79329d4cd6fa0c /tests/drive_del-test.c
parent6e68204646e1167cf1cdb2166099a66d5576a123 (diff)
tests: move virtio entirely to qos-test
The only remaining test that needs libqos-virtio-obj-y is drive_del-test, which really only needs a function. Move that function to the test and remove libqos-virtio-obj-y. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/drive_del-test.c')
-rw-r--r--tests/drive_del-test.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/tests/drive_del-test.c b/tests/drive_del-test.c
index 4a1a0889c8..2f9474e03c 100644
--- a/tests/drive_del-test.c
+++ b/tests/drive_del-test.c
@@ -63,6 +63,24 @@ static void test_drive_without_dev(void)
qtest_end();
}
+/*
+ * qvirtio_get_dev_type:
+ * Returns: the preferred virtio bus/device type for the current architecture.
+ * TODO: delete this
+ */
+static 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";
+ }
+}
+
static void test_after_failed_device_add(void)
{
char driver[32];
@@ -119,16 +137,11 @@ static void test_drive_del_device_del(void)
int main(int argc, char **argv)
{
- const char *arch = qtest_get_arch();
-
g_test_init(&argc, &argv, NULL);
qtest_add_func("/drive_del/without-dev", test_drive_without_dev);
- /* 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, "s390x")) {
+ if (qvirtio_get_dev_type() != NULL) {
qtest_add_func("/drive_del/after_failed_device_add",
test_after_failed_device_add);
qtest_add_func("/blockdev/drive_del_device_del",