2014-02-21 20:36:57 +04: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-08 21:08:51 +03:00
|
|
|
#include "qemu/osdep.h"
|
2019-09-03 08:50:26 +03:00
|
|
|
#include "libqtest-single.h"
|
2019-05-23 17:35:07 +03:00
|
|
|
#include "qemu/module.h"
|
2018-07-18 18:18:46 +03:00
|
|
|
#include "libqos/virtio-serial.h"
|
2014-02-21 20:36:57 +04:00
|
|
|
|
|
|
|
/* Tests only initialization so far. TODO: Replace with functional tests */
|
2018-07-18 18:18:46 +03:00
|
|
|
static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
|
2014-02-21 20:36:57 +04:00
|
|
|
{
|
2018-07-18 18:18:46 +03:00
|
|
|
/* no operation */
|
2014-02-21 20:36:57 +04:00
|
|
|
}
|
|
|
|
|
2018-07-18 18:18:46 +03:00
|
|
|
static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
|
2014-09-26 13:28:07 +04:00
|
|
|
{
|
2019-07-22 18:10:55 +03:00
|
|
|
qtest_qmp_device_add(global_qtest, "virtserialport", "hp-port", "{}");
|
|
|
|
qtest_qmp_device_del(global_qtest, "hp-port");
|
2014-09-26 13:28:07 +04:00
|
|
|
}
|
|
|
|
|
2018-07-18 18:18:46 +03:00
|
|
|
static void register_virtio_serial_test(void)
|
2014-02-21 20:36:57 +04:00
|
|
|
{
|
2018-07-18 18:18:46 +03:00
|
|
|
QOSGraphTestOptions opts = { };
|
2014-02-21 20:36:57 +04:00
|
|
|
|
2018-07-18 18:18:46 +03:00
|
|
|
opts.edge.before_cmd_line = "-device virtconsole,bus=vser0.0";
|
|
|
|
qos_add_test("console-nop", "virtio-serial", virtio_serial_nop, &opts);
|
2014-02-21 20:36:57 +04:00
|
|
|
|
2018-07-18 18:18:46 +03:00
|
|
|
opts.edge.before_cmd_line = "-device virtserialport,bus=vser0.0";
|
|
|
|
qos_add_test("serialport-nop", "virtio-serial", virtio_serial_nop, &opts);
|
2014-02-21 20:36:57 +04:00
|
|
|
|
2018-07-18 18:18:46 +03:00
|
|
|
qos_add_test("hotplug", "virtio-serial", serial_hotplug, NULL);
|
2014-02-21 20:36:57 +04:00
|
|
|
}
|
2018-07-18 18:18:46 +03:00
|
|
|
libqos_init(register_virtio_serial_test);
|