aboutsummaryrefslogtreecommitdiff
path: root/tests/virtio-serial-test.c
diff options
context:
space:
mode:
authorEmanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>2018-07-18 17:18:46 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2019-03-07 17:28:27 +0100
commit1657291afd95f59dc3ef4c9545a7badf7dd75b35 (patch)
tree23d28298fa39a090108ca6eeff6651ef9ae7af37 /tests/virtio-serial-test.c
parentb3e7dc877187073628ec090728fd1aa58ccd60c8 (diff)
qos-test: virtio-console and virtio-serial test node
Convert tests/virtio-console-test and tests/virtio-serial-test in qgraph test node. This test consumes a virtio-serial interface and checks that its function return the expected values. Note that this test does not allocate any virtio-console or virtio-serial structure, it's all done by the qtest walking graph mechanism Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
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);