diff mbox

tests: fix 'make check' failed about usb hcd hotplug

Message ID 1409234071-13972-1-git-send-email-arei.gonglei@huawei.com
State New
Headers show

Commit Message

Gonglei (Arei) Aug. 28, 2014, 1:54 p.m. UTC
From: Gonglei <arei.gonglei@huawei.com>

Rebase the latest qemu master. Fix string formating
question which caused 'make check' failed.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
NB: 
 This patch based on Gerd's usb-next tree:
 https://www.kraxel.org/cgit/qemu/log/?h=rebase/usb-next
---
 tests/usb-hcd-hotplug-test.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)
diff mbox

Patch

diff --git a/tests/usb-hcd-hotplug-test.c b/tests/usb-hcd-hotplug-test.c
index 04bea97..8287b18 100644
--- a/tests/usb-hcd-hotplug-test.c
+++ b/tests/usb-hcd-hotplug-test.c
@@ -16,34 +16,32 @@ 
 static void usb_hcd_hotplug(const char *hcd, const char *id)
 {
     QDict *response;
+    char *bus;
 
     qtest_start("");
 
     /* hotplug an usb host adapter */
-    response = qmp("{\"execute\": \"device_add\","
-                   " \"arguments\": {"
-                   "   \"driver\": \"%s\","
-                   "   \"id\": \"%s\""
-                   "}}", hcd, id);
+    response = qmp("{ 'execute': 'device_add',"
+                   " 'arguments': { 'driver': %s,"
+                   " 'id': %s } }", hcd, id);
     g_assert(response);
     g_assert(!qdict_haskey(response, "error"));
     QDECREF(response);
 
     /* hotplug an usb-tablet to the usb host adapter, bus=$id.0 */
-    response = qmp("{\"execute\": \"device_add\","
-                       " \"arguments\": {"
-                       "   \"driver\": \"usb-tablet\","
-                       "   \"bus\": \"%s.0\""
-                       "}}", id);
+    bus = g_strdup_printf("%s.0", id);
+    response = qmp("{ 'execute': 'device_add',"
+                   "  'arguments': { 'driver': 'usb-tablet',"
+                   "  'bus': %s } }", bus);
+    g_free(bus);
     g_assert(response);
     g_assert(!qdict_haskey(response, "error"));
     QDECREF(response);
 
     /* delete the usb host adapter */
-    response = qmp("{\"execute\": \"device_del\","
-                   " \"arguments\": {"
-                   "   \"id\": \"%s\""
-                   "}}", id);
+    response = qmp("{ 'execute': 'device_del',"
+                   " 'arguments': {"
+                   " 'id': %s } }", id);
     g_assert(response);
     g_assert(!qdict_haskey(response, "error"));
     QDECREF(response);