aboutsummaryrefslogtreecommitdiff
path: root/tests/qtest/virtio-ccw-test.c
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2019-09-09 12:04:01 +0200
committerThomas Huth <thuth@redhat.com>2020-01-12 11:42:41 +0100
commit1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e (patch)
tree80d1a4f0454b9a75c09461e69f969213350540ea /tests/qtest/virtio-ccw-test.c
parent10ae5b303a0de07f0659a2c90d9c1266b3908b97 (diff)
downloadqemu-1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e.zip
qemu-1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e.tar.gz
qemu-1e8a1fae7464ef79c9e50aa0f807d2c511be3c8e.tar.bz2
test: Move qtests to a separate directory
The tests directory itself is pretty overcrowded, and it's hard to see which test belongs to which test subsystem (unit, qtest, ...). Let's move the qtests to a separate folder for more clarity. Message-Id: <20191218103059.11729-6-thuth@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/qtest/virtio-ccw-test.c')
-rw-r--r--tests/qtest/virtio-ccw-test.c115
1 files changed, 115 insertions, 0 deletions
diff --git a/tests/qtest/virtio-ccw-test.c b/tests/qtest/virtio-ccw-test.c
new file mode 100644
index 0000000..d052364
--- /dev/null
+++ b/tests/qtest/virtio-ccw-test.c
@@ -0,0 +1,115 @@
+/*
+ * QTest testcase for VirtIO CCW
+ *
+ * Copyright (c) 2014 SUSE LINUX Products GmbH
+ * Copyright (c) 2018 Red Hat, Inc.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+/* Until we have a full libqos implementation of virtio-ccw (which requires
+ * also to add support for I/O channels to qtest), we can only do simple
+ * tests that initialize the devices.
+ */
+
+#include "qemu/osdep.h"
+#include "libqtest-single.h"
+#include "libqos/virtio.h"
+
+static void virtio_balloon_nop(void)
+{
+ global_qtest = qtest_initf("-device virtio-balloon-ccw");
+ qtest_end();
+}
+
+static void virtconsole_nop(void)
+{
+ global_qtest = qtest_initf("-device virtio-serial-ccw,id=vser0 "
+ "-device virtconsole,bus=vser0.0");
+ qtest_end();
+}
+
+static void virtserialport_nop(void)
+{
+ global_qtest = qtest_initf("-device virtio-serial-ccw,id=vser0 "
+ "-device virtserialport,bus=vser0.0");
+ qtest_end();
+}
+
+static void virtio_serial_nop(void)
+{
+ global_qtest = qtest_initf("-device virtio-serial-ccw");
+ qtest_end();
+}
+
+static void virtio_serial_hotplug(void)
+{
+ QTestState *qts = qtest_initf("-device virtio-serial-ccw");
+
+ qtest_qmp_device_add(qts, "virtserialport", "hp-port", "{}");
+ qtest_qmp_device_del(qts, "hp-port");
+
+ qtest_quit(qts);
+}
+
+static void virtio_blk_nop(void)
+{
+ global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
+ "file.read-zeroes=on,format=raw "
+ "-device virtio-blk-ccw,drive=drv0");
+ qtest_end();
+}
+
+static void virtio_net_nop(void)
+{
+ global_qtest = qtest_initf("-device virtio-net-ccw");
+ qtest_end();
+}
+
+static void virtio_rng_nop(void)
+{
+ global_qtest = qtest_initf("-device virtio-rng-ccw");
+ qtest_end();
+}
+
+static void virtio_scsi_nop(void)
+{
+ global_qtest = qtest_initf("-device virtio-scsi-ccw");
+ qtest_end();
+}
+
+static void virtio_scsi_hotplug(void)
+{
+ QTestState *s = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
+ "file.read-zeroes=on,format=raw "
+ "-drive if=none,id=drv1,file=null-co://,"
+ "file.read-zeroes=on,format=raw "
+ "-device virtio-scsi-ccw "
+ "-device scsi-hd,drive=drv0");
+ qtest_qmp_device_add(s, "scsi-hd", "scsihd", "{'drive': 'drv1'}");
+ qtest_qmp_device_del(s, "scsihd");
+
+ qtest_quit(s);
+}
+
+int main(int argc, char **argv)
+{
+ int ret;
+
+ g_test_init(&argc, &argv, NULL);
+ qtest_add_func("/virtio/balloon/nop", virtio_balloon_nop);
+ qtest_add_func("/virtio/console/nop", virtconsole_nop);
+ qtest_add_func("/virtio/serialport/nop", virtserialport_nop);
+ qtest_add_func("/virtio/serial/nop", virtio_serial_nop);
+ qtest_add_func("/virtio/serial/hotplug", virtio_serial_hotplug);
+ qtest_add_func("/virtio/block/nop", virtio_blk_nop);
+ qtest_add_func("/virtio/net/nop", virtio_net_nop);
+ qtest_add_func("/virtio/rng/nop", virtio_rng_nop);
+ qtest_add_func("/virtio/scsi/nop", virtio_scsi_nop);
+ qtest_add_func("/virtio/scsi/hotplug", virtio_scsi_hotplug);
+
+ ret = g_test_run();
+
+ return ret;
+}