From patchwork Thu Oct 6 14:50:48 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 678964 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 3sqbFx340bz9s9Y for ; Fri, 7 Oct 2016 01:51:48 +1100 (AEDT) Received: from localhost ([::1]:56838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsA1Q-0001WJ-0m for incoming@patchwork.ozlabs.org; Thu, 06 Oct 2016 10:51:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57705) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsA0k-0001CW-LW for qemu-devel@nongnu.org; Thu, 06 Oct 2016 10:51:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bsA0d-0006GB-FA for qemu-devel@nongnu.org; Thu, 06 Oct 2016 10:51:01 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46038) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bsA0d-0006Fw-8l for qemu-devel@nongnu.org; Thu, 06 Oct 2016 10:50:55 -0400 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BF1CE90E64; Thu, 6 Oct 2016 14:50:53 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-112-46.ams2.redhat.com [10.36.112.46]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u96Eooke028574; Thu, 6 Oct 2016 10:50:51 -0400 From: Laurent Vivier To: qemu-devel@nongnu.org Date: Thu, 6 Oct 2016 16:50:48 +0200 Message-Id: <1475765448-18949-1-git-send-email-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 06 Oct 2016 14:50:53 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] tests: minor cleanups in usb-hcd-uhci-test X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Thomas Huth , Gerd Hoffmann , David Gibson Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" Two minor cleanups: - exit gracefully in case on unsupported target, - put machine command line in a constant to avoid to duplicate it. Signed-off-by: Laurent Vivier Reviewed-by: David Gibson Reviewed-by: Gerd Hoffmann --- tests/usb-hcd-uhci-test.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c index 4b951ce..e956b9c 100644 --- a/tests/usb-hcd-uhci-test.c +++ b/tests/usb-hcd-uhci-test.c @@ -77,6 +77,9 @@ static void test_usb_storage_hotplug(void) int main(int argc, char **argv) { const char *arch = qtest_get_arch(); + const char *cmd = "-device piix3-usb-uhci,id=uhci,addr=1d.0" + " -drive id=drive0,if=none,file=/dev/null,format=raw" + " -device usb-tablet,bus=uhci.0,port=1"; int ret; g_test_init(&argc, &argv, NULL); @@ -87,13 +90,13 @@ int main(int argc, char **argv) qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug); if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) { - qs = qtest_pc_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0" - " -drive id=drive0,if=none,file=/dev/null,format=raw" - " -device usb-tablet,bus=uhci.0,port=1"); + qs = qtest_pc_boot(cmd); } else if (strcmp(arch, "ppc64") == 0) { - qs = qtest_spapr_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0" - " -drive id=drive0,if=none,file=/dev/null,format=raw" - " -device usb-tablet,bus=uhci.0,port=1"); + qs = qtest_spapr_boot(cmd); + } else { + g_printerr("usb-hcd-uhci-test tests are only " + "available on x86 or ppc64\n"); + exit(EXIT_FAILURE); } ret = g_test_run(); qtest_shutdown(qs);