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