From patchwork Thu Aug 28 13:54:31 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gonglei (Arei)" X-Patchwork-Id: 383844 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 0B0A914011E for ; Thu, 28 Aug 2014 23:55:23 +1000 (EST) Received: from localhost ([::1]:36672 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN0Ab-0001xj-AC for incoming@patchwork.ozlabs.org; Thu, 28 Aug 2014 09:55:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56079) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN0AG-0001ZK-PA for qemu-devel@nongnu.org; Thu, 28 Aug 2014 09:55:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XN0AC-000500-0n for qemu-devel@nongnu.org; Thu, 28 Aug 2014 09:55:00 -0400 Received: from szxga02-in.huawei.com ([119.145.14.65]:23626) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XN0AB-0004yf-8S for qemu-devel@nongnu.org; Thu, 28 Aug 2014 09:54:55 -0400 Received: from 172.24.2.119 (EHLO szxeml417-hub.china.huawei.com) ([172.24.2.119]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id BYT01451; Thu, 28 Aug 2014 21:54:49 +0800 (CST) Received: from localhost (10.177.19.102) by szxeml417-hub.china.huawei.com (10.82.67.156) with Microsoft SMTP Server id 14.3.158.1; Thu, 28 Aug 2014 21:54:39 +0800 From: To: Date: Thu, 28 Aug 2014 21:54:31 +0800 Message-ID: <1409234071-13972-1-git-send-email-arei.gonglei@huawei.com> X-Mailer: git-send-email 1.7.3.1.msysgit.0 MIME-Version: 1.0 X-Originating-IP: [10.177.19.102] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 119.145.14.65 Cc: Gonglei , weidong.huang@huawei.com, kraxel@redhat.com Subject: [Qemu-devel] [PATCH] tests: fix 'make check' failed about usb hcd hotplug X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Gonglei Rebase the latest qemu master. Fix string formating question which caused 'make check' failed. Signed-off-by: Gonglei --- 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);