Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
[qemu.git] / tests / qtest / virtio-serial-test.c
blob2541034822d89fba0102222634de2ed185274dde
1 /*
2 * QTest testcase for VirtIO Serial
4 * Copyright (c) 2014 SUSE LINUX Products GmbH
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
10 #include "qemu/osdep.h"
11 #include "libqtest-single.h"
12 #include "qemu/module.h"
13 #include "libqos/virtio-serial.h"
15 /* Tests only initialization so far. TODO: Replace with functional tests */
16 static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
18 /* no operation */
21 static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
23 qtest_qmp_device_add(global_qtest, "virtserialport", "hp-port", "{}");
24 qtest_qmp_device_del(global_qtest, "hp-port");
27 static void register_virtio_serial_test(void)
29 QOSGraphTestOptions opts = { };
31 opts.edge.before_cmd_line = "-device virtconsole,bus=vser0.0";
32 qos_add_test("console-nop", "virtio-serial", virtio_serial_nop, &opts);
34 opts.edge.before_cmd_line = "-device virtserialport,bus=vser0.0";
35 qos_add_test("serialport-nop", "virtio-serial", virtio_serial_nop, &opts);
37 qos_add_test("hotplug", "virtio-serial", serial_hotplug, NULL);
39 libqos_init(register_virtio_serial_test);