virtio-serial-test.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * QTest testcase for VirtIO Serial
  3. *
  4. * Copyright (c) 2014 SUSE LINUX Products GmbH
  5. *
  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. */
  9. #include "qemu/osdep.h"
  10. #include "libqtest-single.h"
  11. #include "qemu/module.h"
  12. #include "libqos/virtio-serial.h"
  13. /* Tests only initialization so far. TODO: Replace with functional tests */
  14. static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
  15. {
  16. /* no operation */
  17. }
  18. static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
  19. {
  20. qtest_qmp_device_add(global_qtest, "virtserialport", "hp-port", "{}");
  21. qtest_qmp_device_del(global_qtest, "hp-port");
  22. }
  23. static void register_virtio_serial_test(void)
  24. {
  25. QOSGraphTestOptions opts = { };
  26. opts.edge.before_cmd_line = "-device virtconsole,bus=vser0.0";
  27. qos_add_test("console-nop", "virtio-serial", virtio_serial_nop, &opts);
  28. opts.edge.before_cmd_line = "-device virtserialport,bus=vser0.0";
  29. qos_add_test("serialport-nop", "virtio-serial", virtio_serial_nop, &opts);
  30. qos_add_test("hotplug", "virtio-serial", serial_hotplug, NULL);
  31. }
  32. libqos_init(register_virtio_serial_test);