2014-02-22 00:36:57 +08:00
|
|
|
/*
|
|
|
|
* QTest testcase for VirtIO Serial
|
|
|
|
*
|
|
|
|
* Copyright (c) 2014 SUSE LINUX Products GmbH
|
|
|
|
*
|
|
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
|
|
* See the COPYING file in the top-level directory.
|
|
|
|
*/
|
|
|
|
|
2016-02-09 02:08:51 +08:00
|
|
|
#include "qemu/osdep.h"
|
2019-09-03 13:50:26 +08:00
|
|
|
#include "libqtest-single.h"
|
2019-05-23 22:35:07 +08:00
|
|
|
#include "qemu/module.h"
|
2018-07-18 23:18:46 +08:00
|
|
|
#include "libqos/virtio-serial.h"
|
2014-02-22 00:36:57 +08:00
|
|
|
|
|
|
|
/* Tests only initialization so far. TODO: Replace with functional tests */
|
2018-07-18 23:18:46 +08:00
|
|
|
static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
|
2014-02-22 00:36:57 +08:00
|
|
|
{
|
2018-07-18 23:18:46 +08:00
|
|
|
/* no operation */
|
2014-02-22 00:36:57 +08:00
|
|
|
}
|
|
|
|
|
2018-07-18 23:18:46 +08:00
|
|
|
static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
|
2014-09-26 17:28:07 +08:00
|
|
|
{
|
2019-07-22 23:10:55 +08:00
|
|
|
qtest_qmp_device_add(global_qtest, "virtserialport", "hp-port", "{}");
|
|
|
|
qtest_qmp_device_del(global_qtest, "hp-port");
|
2014-09-26 17:28:07 +08:00
|
|
|
}
|
|
|
|
|
2018-07-18 23:18:46 +08:00
|
|
|
static void register_virtio_serial_test(void)
|
2014-02-22 00:36:57 +08:00
|
|
|
{
|
2018-07-18 23:18:46 +08:00
|
|
|
QOSGraphTestOptions opts = { };
|
2014-02-22 00:36:57 +08:00
|
|
|
|
2018-07-18 23:18:46 +08:00
|
|
|
opts.edge.before_cmd_line = "-device virtconsole,bus=vser0.0";
|
|
|
|
qos_add_test("console-nop", "virtio-serial", virtio_serial_nop, &opts);
|
2014-02-22 00:36:57 +08:00
|
|
|
|
2018-07-18 23:18:46 +08:00
|
|
|
opts.edge.before_cmd_line = "-device virtserialport,bus=vser0.0";
|
|
|
|
qos_add_test("serialport-nop", "virtio-serial", virtio_serial_nop, &opts);
|
2014-02-22 00:36:57 +08:00
|
|
|
|
2018-07-18 23:18:46 +08:00
|
|
|
qos_add_test("hotplug", "virtio-serial", serial_hotplug, NULL);
|
2014-02-22 00:36:57 +08:00
|
|
|
}
|
2018-07-18 23:18:46 +08:00
|
|
|
libqos_init(register_virtio_serial_test);
|