blob: 2541034822d89fba0102222634de2ed185274dde [file] [log] [blame]
Andreas Färberaa974052014-02-21 17:36:57 +01001/*
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
Andreas Färberaa974052014-02-21 17:36:57 +010010#include "qemu/osdep.h"
Thomas Huthdd210742019-09-03 07:50:26 +020011#include "libqtest-single.h"
Markus Armbruster0b8fa322019-05-23 16:35:07 +020012#include "qemu/module.h"
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020013#include "libqos/virtio-serial.h"
Andreas Färberaa974052014-02-21 17:36:57 +010014
15/* Tests only initialization so far. TODO: Replace with functional tests */
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020016static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
Andreas Färberaa974052014-02-21 17:36:57 +010017{
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020018 /* no operation */
Andreas Färberaa974052014-02-21 17:36:57 +010019}
20
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020021static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
Igor Mammedov823a9982014-09-26 09:28:07 +000022{
Thomas Huthe5758de2019-07-22 17:10:55 +020023 qtest_qmp_device_add(global_qtest, "virtserialport", "hp-port", "{}");
24 qtest_qmp_device_del(global_qtest, "hp-port");
Igor Mammedov823a9982014-09-26 09:28:07 +000025}
26
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020027static void register_virtio_serial_test(void)
Andreas Färberaa974052014-02-21 17:36:57 +010028{
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020029 QOSGraphTestOptions opts = { };
Andreas Färberaa974052014-02-21 17:36:57 +010030
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020031 opts.edge.before_cmd_line = "-device virtconsole,bus=vser0.0";
32 qos_add_test("console-nop", "virtio-serial", virtio_serial_nop, &opts);
Andreas Färberaa974052014-02-21 17:36:57 +010033
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020034 opts.edge.before_cmd_line = "-device virtserialport,bus=vser0.0";
35 qos_add_test("serialport-nop", "virtio-serial", virtio_serial_nop, &opts);
Andreas Färberaa974052014-02-21 17:36:57 +010036
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020037 qos_add_test("hotplug", "virtio-serial", serial_hotplug, NULL);
Andreas Färberaa974052014-02-21 17:36:57 +010038}
Emanuele Giuseppe Esposito16572912018-07-18 17:18:46 +020039libqos_init(register_virtio_serial_test);