hw/timer/exynos4210_mct.c: Switch ltick to transaction-based ptimer API
[qemu/ar7.git] / tests / virtio-ccw-test.c
blobd05236407b0e5ef5a532f988b041e5afa550022f
1 /*
2 * QTest testcase for VirtIO CCW
4 * Copyright (c) 2014 SUSE LINUX Products GmbH
5 * Copyright (c) 2018 Red Hat, Inc.
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.
9 */
11 /* Until we have a full libqos implementation of virtio-ccw (which requires
12 * also to add support for I/O channels to qtest), we can only do simple
13 * tests that initialize the devices.
16 #include "qemu/osdep.h"
17 #include "libqtest-single.h"
18 #include "libqos/virtio.h"
20 static void virtio_balloon_nop(void)
22 global_qtest = qtest_initf("-device virtio-balloon-ccw");
23 qtest_end();
26 static void virtconsole_nop(void)
28 global_qtest = qtest_initf("-device virtio-serial-ccw,id=vser0 "
29 "-device virtconsole,bus=vser0.0");
30 qtest_end();
33 static void virtserialport_nop(void)
35 global_qtest = qtest_initf("-device virtio-serial-ccw,id=vser0 "
36 "-device virtserialport,bus=vser0.0");
37 qtest_end();
40 static void virtio_serial_nop(void)
42 global_qtest = qtest_initf("-device virtio-serial-ccw");
43 qtest_end();
46 static void virtio_serial_hotplug(void)
48 QTestState *qts = qtest_initf("-device virtio-serial-ccw");
50 qtest_qmp_device_add(qts, "virtserialport", "hp-port", "{}");
51 qtest_qmp_device_del(qts, "hp-port");
53 qtest_quit(qts);
56 static void virtio_blk_nop(void)
58 global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
59 "file.read-zeroes=on,format=raw "
60 "-device virtio-blk-ccw,drive=drv0");
61 qtest_end();
64 static void virtio_net_nop(void)
66 global_qtest = qtest_initf("-device virtio-net-ccw");
67 qtest_end();
70 static void virtio_rng_nop(void)
72 global_qtest = qtest_initf("-device virtio-rng-ccw");
73 qtest_end();
76 static void virtio_scsi_nop(void)
78 global_qtest = qtest_initf("-device virtio-scsi-ccw");
79 qtest_end();
82 static void virtio_scsi_hotplug(void)
84 QTestState *s = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
85 "file.read-zeroes=on,format=raw "
86 "-drive if=none,id=drv1,file=null-co://,"
87 "file.read-zeroes=on,format=raw "
88 "-device virtio-scsi-ccw "
89 "-device scsi-hd,drive=drv0");
90 qtest_qmp_device_add(s, "scsi-hd", "scsihd", "{'drive': 'drv1'}");
91 qtest_qmp_device_del(s, "scsihd");
93 qtest_quit(s);
96 int main(int argc, char **argv)
98 int ret;
100 g_test_init(&argc, &argv, NULL);
101 qtest_add_func("/virtio/balloon/nop", virtio_balloon_nop);
102 qtest_add_func("/virtio/console/nop", virtconsole_nop);
103 qtest_add_func("/virtio/serialport/nop", virtserialport_nop);
104 qtest_add_func("/virtio/serial/nop", virtio_serial_nop);
105 qtest_add_func("/virtio/serial/hotplug", virtio_serial_hotplug);
106 qtest_add_func("/virtio/block/nop", virtio_blk_nop);
107 qtest_add_func("/virtio/net/nop", virtio_net_nop);
108 qtest_add_func("/virtio/rng/nop", virtio_rng_nop);
109 qtest_add_func("/virtio/scsi/nop", virtio_scsi_nop);
110 qtest_add_func("/virtio/scsi/hotplug", virtio_scsi_hotplug);
112 ret = g_test_run();
114 return ret;