]> Git Repo - qemu.git/blob - tests/virtio-ccw-test.c
tests/tpm: Display if swtpm is not found or --tpm2 not supported
[qemu.git] / tests / virtio-ccw-test.c
1 /*
2  * QTest testcase for VirtIO CCW
3  *
4  * Copyright (c) 2014 SUSE LINUX Products GmbH
5  * Copyright (c) 2018 Red Hat, Inc.
6  *
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  */
10
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.
14  */
15
16 #include "qemu/osdep.h"
17 #include "libqtest.h"
18 #include "libqos/virtio.h"
19
20 static void virtio_balloon_nop(void)
21 {
22     global_qtest = qtest_initf("-device virtio-balloon-ccw");
23     qtest_end();
24 }
25
26 static void virtconsole_nop(void)
27 {
28     global_qtest = qtest_initf("-device virtio-serial-ccw,id=vser0 "
29                                 "-device virtconsole,bus=vser0.0");
30     qtest_end();
31 }
32
33 static void virtserialport_nop(void)
34 {
35     global_qtest = qtest_initf("-device virtio-serial-ccw,id=vser0 "
36                                 "-device virtserialport,bus=vser0.0");
37     qtest_end();
38 }
39
40 static void virtio_serial_nop(void)
41 {
42     global_qtest = qtest_initf("-device virtio-serial-ccw");
43     qtest_end();
44 }
45
46 static void virtio_serial_hotplug(void)
47 {
48     global_qtest = qtest_initf("-device virtio-serial-ccw");
49     qtest_qmp_device_add("virtserialport", "hp-port", "{}");
50     qtest_qmp_device_del("hp-port");
51     qtest_end();
52 }
53
54 static void virtio_blk_nop(void)
55 {
56     global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,format=raw "
57                                 "-device virtio-blk-ccw,drive=drv0");
58     qtest_end();
59 }
60
61 static void virtio_net_nop(void)
62 {
63     global_qtest = qtest_initf("-device virtio-net-ccw");
64     qtest_end();
65 }
66
67 static void virtio_rng_nop(void)
68 {
69     global_qtest = qtest_initf("-device virtio-rng-ccw");
70     qtest_end();
71 }
72
73 static void virtio_scsi_nop(void)
74 {
75     global_qtest = qtest_initf("-device virtio-scsi-ccw");
76     qtest_end();
77 }
78
79 static void virtio_scsi_hotplug(void)
80 {
81     global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,format=raw "
82                                 "-drive if=none,id=drv1,file=null-co://,format=raw "
83                                 "-device virtio-scsi-ccw "
84                                 "-device scsi-hd,drive=drv0");
85     qtest_qmp_device_add("scsi-hd", "scsihd", "{'drive': 'drv1'}");
86     qtest_qmp_device_del("scsihd");
87
88     qtest_end();
89 }
90
91 int main(int argc, char **argv)
92 {
93     int ret;
94
95     g_test_init(&argc, &argv, NULL);
96     qtest_add_func("/virtio/balloon/nop", virtio_balloon_nop);
97     qtest_add_func("/virtio/console/nop", virtconsole_nop);
98     qtest_add_func("/virtio/serialport/nop", virtserialport_nop);
99     qtest_add_func("/virtio/serial/nop", virtio_serial_nop);
100     qtest_add_func("/virtio/serial/hotplug", virtio_serial_hotplug);
101     qtest_add_func("/virtio/block/nop", virtio_blk_nop);
102     qtest_add_func("/virtio/net/nop", virtio_net_nop);
103     qtest_add_func("/virtio/rng/nop", virtio_rng_nop);
104     qtest_add_func("/virtio/scsi/nop", virtio_scsi_nop);
105     qtest_add_func("/virtio/scsi/hotplug", virtio_scsi_hotplug);
106
107     ret = g_test_run();
108
109     return ret;
110 }
This page took 0.029964 seconds and 4 git commands to generate.