diff options
| author | Peter Maydell <peter.maydell@linaro.org> | 2017-09-15 20:29:44 +0100 |
|---|---|---|
| committer | Peter Maydell <peter.maydell@linaro.org> | 2017-09-15 20:29:44 +0100 |
| commit | 5faf2d376af3cb4eb92da44c2580e08d39832caa (patch) | |
| tree | f6eec20c54a2477b61c0426d3676a9c3a7c4d425 /tests/libqos/usb.c | |
| parent | d535f5d363e29ad6f07e2df4c1ef1d3f17222198 (diff) | |
| parent | 7b899f4dd596dbb7d271f7fab36fbfffec84868e (diff) | |
| download | focaccia-qemu-5faf2d376af3cb4eb92da44c2580e08d39832caa.tar.gz focaccia-qemu-5faf2d376af3cb4eb92da44c2580e08d39832caa.zip | |
Merge remote-tracking branch 'remotes/huth/tags/check-20170915' into staging
Some fixes and improvements for various qtests by Eric and me. # gpg: Signature made Fri 15 Sep 2017 08:37:21 BST # gpg: using RSA key 0x2ED9D774FE702DB5 # gpg: Good signature from "Thomas Huth <th.huth@gmx.de>" # gpg: aka "Thomas Huth <thuth@redhat.com>" # gpg: aka "Thomas Huth <huth@tuxfamily.org>" # gpg: aka "Thomas Huth <th.huth@posteo.de>" # Primary key fingerprint: 27B8 8847 EEE0 2501 18F3 EAB9 2ED9 D774 FE70 2DB5 * remotes/huth/tags/check-20170915: qtest: Avoid passing raw strings through hmp() libqtest: Remove dead qtest_instances variable numa-test: Use hmp() qtest: Don't perform side effects inside assertion test-qga: Kill broken and dead QGA_TEST_SIDE_EFFECTING code tests: Fix broken ivshmem-server-msi/-irq tests tests/libqtest: Use a proper error message if QTEST_QEMU_BINARY is missing tests/test-hmp: Remove puv3 and tricore_testboard from the blacklist tests: Introduce generic device hot-plug/hot-unplug functions Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'tests/libqos/usb.c')
| -rw-r--r-- | tests/libqos/usb.c | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/tests/libqos/usb.c b/tests/libqos/usb.c index 0cdfaecda7..2a476049a8 100644 --- a/tests/libqos/usb.c +++ b/tests/libqos/usb.c @@ -40,34 +40,16 @@ void uhci_port_test(struct qhc *hc, int port, uint16_t expect) void usb_test_hotplug(const char *hcd_id, const int port, void (*port_check)(void)) { - QDict *response; - char *cmd; + char *id = g_strdup_printf("usbdev%d", port); - cmd = g_strdup_printf("{'execute': 'device_add'," - " 'arguments': {" - " 'driver': 'usb-tablet'," - " 'port': '%d'," - " 'bus': '%s.0'," - " 'id': 'usbdev%d'" - "}}", port, hcd_id, port); - response = qmp(cmd); - g_free(cmd); - g_assert(response); - g_assert(!qdict_haskey(response, "error")); - QDECREF(response); + qtest_qmp_device_add("usb-tablet", id, "'port': '%d', 'bus': '%s.0'", + port, hcd_id); if (port_check) { port_check(); } - cmd = g_strdup_printf("{'execute': 'device_del'," - " 'arguments': {" - " 'id': 'usbdev%d'" - "}}", port); - response = qmp(cmd); - g_free(cmd); - g_assert(response); - g_assert(qdict_haskey(response, "event")); - g_assert(!strcmp(qdict_get_str(response, "event"), "DEVICE_DELETED")); - QDECREF(response); + qtest_qmp_device_del(id); + + g_free(id); } |