summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2023-08-22 18:30:24 +0200
committerThomas Huth <thuth@redhat.com>2023-08-31 19:10:01 +0200
commit0a1e462daf03bf0c8119e4369807d0d4a965fbc6 (patch)
tree1ea1cb399a8bb8b285f0aa985c83a9f180021013
parentc3513ce5c8736807cb4e5ff529eebadf7a82dbde (diff)
downloadfocaccia-qemu-0a1e462daf03bf0c8119e4369807d0d4a965fbc6.tar.gz
focaccia-qemu-0a1e462daf03bf0c8119e4369807d0d4a965fbc6.zip
tests/qtest/usb-hcd-xhci-test: Check availability of devices before using them
The "usb-uas" and "usb-ccid" might not be compiled into the QEMU binary,
so let's better check first whether they are available.

Message-Id: <20230822163024.61529-1-thuth@redhat.com>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
-rw-r--r--tests/qtest/usb-hcd-xhci-test.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/qtest/usb-hcd-xhci-test.c b/tests/qtest/usb-hcd-xhci-test.c
index 10ef9d2a91..80bc039446 100644
--- a/tests/qtest/usb-hcd-xhci-test.c
+++ b/tests/qtest/usb-hcd-xhci-test.c
@@ -56,8 +56,12 @@ int main(int argc, char **argv)
 
     qtest_add_func("/xhci/pci/init", test_xhci_init);
     qtest_add_func("/xhci/pci/hotplug", test_xhci_hotplug);
-    qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug);
-    qtest_add_func("/xhci/pci/hotplug/usb-ccid", test_usb_ccid_hotplug);
+    if (qtest_has_device("usb-uas")) {
+        qtest_add_func("/xhci/pci/hotplug/usb-uas", test_usb_uas_hotplug);
+    }
+    if (qtest_has_device("usb-ccid")) {
+        qtest_add_func("/xhci/pci/hotplug/usb-ccid", test_usb_ccid_hotplug);
+    }
 
     qtest_start("-device nec-usb-xhci,id=xhci"
                 " -drive id=drive0,if=none,file=null-co://,"