qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] tests: fix 'make check' failed about usb hcd hotplu


From: arei.gonglei
Subject: [Qemu-devel] [PATCH] tests: fix 'make check' failed about usb hcd hotplug
Date: Thu, 28 Aug 2014 21:54:31 +0800

From: Gonglei <address@hidden>

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

Signed-off-by: Gonglei <address@hidden>
---
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 --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);
-- 
1.7.12.4





reply via email to

[Prev in Thread] Current Thread [Next in Thread]