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