aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2019-07-22 17:10:55 +0200
committerThomas Huth <thuth@redhat.com>2019-08-15 19:24:10 +0200
commite5758de4e836c3b2edc2befd904651fc6967d74f (patch)
tree324827884570aa10cb22024f8735e43178e3a947 /tests/libqos
parent17de4741296af8ed3361b14feda130a7d7102987 (diff)
tests/libqtest: Make qtest_qmp_device_add/del independent from global_qtest
Generic library functions like qtest_qmp_device_add() and _del() should not depend on the global_qtest variable. Pass the test state via parameter instead. Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20190813093047.27948-6-thuth@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/libqos')
-rw-r--r--tests/libqos/usb.c6
-rw-r--r--tests/libqos/usb.h2
2 files changed, 4 insertions, 4 deletions
diff --git a/tests/libqos/usb.c b/tests/libqos/usb.c
index 49e2f4bc0a..d7a9cb3c72 100644
--- a/tests/libqos/usb.c
+++ b/tests/libqos/usb.c
@@ -37,20 +37,20 @@ void uhci_port_test(struct qhc *hc, int port, uint16_t expect)
g_assert((value & mask) == (expect & mask));
}
-void usb_test_hotplug(const char *hcd_id, const char *port,
+void usb_test_hotplug(QTestState *qts, const char *hcd_id, const char *port,
void (*port_check)(void))
{
char *id = g_strdup_printf("usbdev%s", port);
char *bus = g_strdup_printf("%s.0", hcd_id);
- qtest_qmp_device_add("usb-tablet", id, "{'port': %s, 'bus': %s}",
+ qtest_qmp_device_add(qts, "usb-tablet", id, "{'port': %s, 'bus': %s}",
port, bus);
if (port_check) {
port_check();
}
- qtest_qmp_device_del(id);
+ qtest_qmp_device_del(qts, id);
g_free(bus);
g_free(id);
diff --git a/tests/libqos/usb.h b/tests/libqos/usb.h
index c506418a13..eeced39a2f 100644
--- a/tests/libqos/usb.h
+++ b/tests/libqos/usb.h
@@ -13,6 +13,6 @@ void qusb_pci_init_one(QPCIBus *pcibus, struct qhc *hc,
void uhci_port_test(struct qhc *hc, int port, uint16_t expect);
void uhci_deinit(struct qhc *hc);
-void usb_test_hotplug(const char *bus_name, const char *port,
+void usb_test_hotplug(QTestState *qts, const char *bus_name, const char *port,
void (*port_check)(void));
#endif