* See the COPYING file in the top-level directory.
*/
-#include <glib.h>
-#include <string.h>
-#include "libqtest.h"
#include "qemu/osdep.h"
+#include "libqtest.h"
+#include "libqos/virtio-serial.h"
/* Tests only initialization so far. TODO: Replace with functional tests */
-static void pci_nop(void)
+static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
{
+ /* no operation */
}
-int main(int argc, char **argv)
+static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
{
- int ret;
+ qtest_qmp_device_add("virtserialport", "hp-port", "{}");
+ qtest_qmp_device_del("hp-port");
+}
- g_test_init(&argc, &argv, NULL);
- qtest_add_func("/virtio/serial/pci/nop", pci_nop);
+static void register_virtio_serial_test(void)
+{
+ QOSGraphTestOptions opts = { };
- qtest_start("-device virtio-serial-pci");
- 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);