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"
|
2014-02-22 00:36:57 +08:00
|
|
|
#include "libqtest.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
|
|
|
{
|
2018-08-06 14:53:35 +08:00
|
|
|
qtest_qmp_device_add("virtserialport", "hp-port", "{}");
|
2017-08-15 14:58:54 +08:00
|
|
|
qtest_qmp_device_del("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);
|