summaryrefslogtreecommitdiff
path: root/tests/usb-hcd-uhci-test.c
diff options
context:
space:
mode:
authorLaurent Vivier <lvivier@redhat.com>2016-10-06 16:50:48 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-10-14 10:06:47 +1100
commit44a3dd9b8718a7f0a94053c57782886748a43d7a (patch)
treeaedebcb4f11546ef4093c732894a42e9df0423a9 /tests/usb-hcd-uhci-test.c
parent6aa5a3679449cdf0b6fe5a6829b22e642ded57fd (diff)
downloadqemu-44a3dd9b8718a7f0a94053c57782886748a43d7a.tar.gz
tests: minor cleanups in usb-hcd-uhci-test
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 <lvivier@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'tests/usb-hcd-uhci-test.c')
-rw-r--r--tests/usb-hcd-uhci-test.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c
index 4b951ce492..e956b9ccb7 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);