Andreas Färber | aa97405 | 2014-02-21 17:36:57 +0100 | [diff] [blame] | 1 | /* |
| 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ärber | aa97405 | 2014-02-21 17:36:57 +0100 | [diff] [blame] | 10 | #include "qemu/osdep.h" |
Peter Maydell | 681c28a | 2016-02-08 18:08:51 +0000 | [diff] [blame] | 11 | #include "libqtest.h" |
Thomas Huth | d0a5cc5 | 2017-10-18 16:20:28 +0200 | [diff] [blame] | 12 | #include "libqos/virtio.h" |
Andreas Färber | aa97405 | 2014-02-21 17:36:57 +0100 | [diff] [blame] | 13 | |
| 14 | /* Tests only initialization so far. TODO: Replace with functional tests */ |
Thomas Huth | d0a5cc5 | 2017-10-18 16:20:28 +0200 | [diff] [blame] | 15 | static void virtio_serial_nop(void) |
Andreas Färber | aa97405 | 2014-02-21 17:36:57 +0100 | [diff] [blame] | 16 | { |
| 17 | } |
| 18 | |
Igor Mammedov | 823a998 | 2014-09-26 09:28:07 +0000 | [diff] [blame] | 19 | static void hotplug(void) |
| 20 | { |
Thomas Huth | acd8001 | 2017-08-15 08:58:54 +0200 | [diff] [blame] | 21 | qtest_qmp_device_add("virtserialport", "hp-port", NULL); |
Igor Mammedov | 823a998 | 2014-09-26 09:28:07 +0000 | [diff] [blame] | 22 | |
Thomas Huth | acd8001 | 2017-08-15 08:58:54 +0200 | [diff] [blame] | 23 | qtest_qmp_device_del("hp-port"); |
Igor Mammedov | 823a998 | 2014-09-26 09:28:07 +0000 | [diff] [blame] | 24 | } |
| 25 | |
Andreas Färber | aa97405 | 2014-02-21 17:36:57 +0100 | [diff] [blame] | 26 | int main(int argc, char **argv) |
| 27 | { |
| 28 | int ret; |
| 29 | |
| 30 | g_test_init(&argc, &argv, NULL); |
Thomas Huth | d0a5cc5 | 2017-10-18 16:20:28 +0200 | [diff] [blame] | 31 | qtest_add_func("/virtio/serial/nop", virtio_serial_nop); |
| 32 | qtest_add_func("/virtio/serial/hotplug", hotplug); |
Andreas Färber | aa97405 | 2014-02-21 17:36:57 +0100 | [diff] [blame] | 33 | |
Thomas Huth | d0a5cc5 | 2017-10-18 16:20:28 +0200 | [diff] [blame] | 34 | global_qtest = qtest_startf("-device virtio-serial-%s", |
| 35 | qvirtio_get_dev_type()); |
Andreas Färber | aa97405 | 2014-02-21 17:36:57 +0100 | [diff] [blame] | 36 | ret = g_test_run(); |
| 37 | |
| 38 | qtest_end(); |
| 39 | |
| 40 | return ret; |
| 41 | } |