aboutsummaryrefslogtreecommitdiff
path: root/tests/virtio-serial-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/virtio-serial-test.c')
-rw-r--r--tests/virtio-serial-test.c27
1 files changed, 12 insertions, 15 deletions
diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c
index 8da9980a24..85f35e09b7 100644
--- a/tests/virtio-serial-test.c
+++ b/tests/virtio-serial-test.c
@@ -9,33 +9,30 @@
#include "qemu/osdep.h"
#include "libqtest.h"
-#include "libqos/virtio.h"
+#include "libqos/virtio-serial.h"
/* Tests only initialization so far. TODO: Replace with functional tests */
-static void virtio_serial_nop(void)
+static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
{
+ /* no operation */
}
-static void hotplug(void)
+static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
{
qtest_qmp_device_add("virtserialport", "hp-port", "{}");
-
qtest_qmp_device_del("hp-port");
}
-int main(int argc, char **argv)
+static void register_virtio_serial_test(void)
{
- int ret;
-
- g_test_init(&argc, &argv, NULL);
- qtest_add_func("/virtio/serial/nop", virtio_serial_nop);
- qtest_add_func("/virtio/serial/hotplug", hotplug);
+ QOSGraphTestOptions opts = { };
- global_qtest = qtest_initf("-device virtio-serial-%s",
- qvirtio_get_dev_type());
- ret = g_test_run();
+ opts.edge.before_cmd_line = "-device virtconsole,bus=vser0.0";
+ qos_add_test("console-nop", "virtio-serial", virtio_serial_nop, &opts);
- qtest_end();
+ opts.edge.before_cmd_line = "-device virtserialport,bus=vser0.0";
+ qos_add_test("serialport-nop", "virtio-serial", virtio_serial_nop, &opts);
- return ret;
+ qos_add_test("hotplug", "virtio-serial", serial_hotplug, NULL);
}
+libqos_init(register_virtio_serial_test);