blob: 7cc7060264593a4cf47d55d099d51821ad736991 [file] [log] [blame]
Andreas Färberaa974052014-02-21 17:36:57 +01001/*
2 * QTest testcase for VirtIO Serial
3 *
4 * Copyright (c) 2014 SUSE LINUX Products GmbH
5 *
6 * This work is licensed under the terms of the GNU GPL, version 2 or later.
7 * See the COPYING file in the top-level directory.
8 */
9
Andreas Färberaa974052014-02-21 17:36:57 +010010#include "qemu/osdep.h"
Peter Maydell681c28a2016-02-08 18:08:51 +000011#include "libqtest.h"
Thomas Huthd0a5cc52017-10-18 16:20:28 +020012#include "libqos/virtio.h"
Andreas Färberaa974052014-02-21 17:36:57 +010013
14/* Tests only initialization so far. TODO: Replace with functional tests */
Thomas Huthd0a5cc52017-10-18 16:20:28 +020015static void virtio_serial_nop(void)
Andreas Färberaa974052014-02-21 17:36:57 +010016{
17}
18
Igor Mammedov823a9982014-09-26 09:28:07 +000019static void hotplug(void)
20{
Thomas Huthacd80012017-08-15 08:58:54 +020021 qtest_qmp_device_add("virtserialport", "hp-port", NULL);
Igor Mammedov823a9982014-09-26 09:28:07 +000022
Thomas Huthacd80012017-08-15 08:58:54 +020023 qtest_qmp_device_del("hp-port");
Igor Mammedov823a9982014-09-26 09:28:07 +000024}
25
Andreas Färberaa974052014-02-21 17:36:57 +010026int main(int argc, char **argv)
27{
28 int ret;
29
30 g_test_init(&argc, &argv, NULL);
Thomas Huthd0a5cc52017-10-18 16:20:28 +020031 qtest_add_func("/virtio/serial/nop", virtio_serial_nop);
32 qtest_add_func("/virtio/serial/hotplug", hotplug);
Andreas Färberaa974052014-02-21 17:36:57 +010033
Thomas Huthd0a5cc52017-10-18 16:20:28 +020034 global_qtest = qtest_startf("-device virtio-serial-%s",
35 qvirtio_get_dev_type());
Andreas Färberaa974052014-02-21 17:36:57 +010036 ret = g_test_run();
37
38 qtest_end();
39
40 return ret;
41}