[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 08/30] test: usb: usb-storage hotplug test
From: |
Igor Mammedov |
Subject: |
[Qemu-devel] [PATCH 08/30] test: usb: usb-storage hotplug test |
Date: |
Wed, 24 Sep 2014 11:47:57 +0000 |
usb-storage is different from usual usb devices
in that it uses child SCSI bus for underlying storage.
That patch checks that SCSI bus is hotpluggable for
hotplug operation wouldn't succeed without it.
Signed-off-by: Igor Mammedov <address@hidden>
---
tests/usb-hcd-uhci-test.c | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c
index ce27962..bf1d52e 100644
--- a/tests/usb-hcd-uhci-test.c
+++ b/tests/usb-hcd-uhci-test.c
@@ -46,6 +46,34 @@ static void test_uhci_hotplug(void)
usb_test_hotplug("uhci", 2, test_port_2);
}
+static void test_usb_storage_hotplug(void)
+{
+ QDict *response;
+
+ response = qmp("{'execute': 'device_add',"
+ " 'arguments': {"
+ " 'driver': 'usb-storage',"
+ " 'drive': 'drive0',"
+ " 'id': 'usbdev0'"
+ "}}");
+ g_assert(response);
+ g_assert(!qdict_haskey(response, "error"));
+ QDECREF(response);
+
+ response = qmp("{'execute': 'device_del',"
+ " 'arguments': {"
+ " 'id': 'usbdev0'"
+ "}}");
+ g_assert(response);
+ g_assert(!qdict_haskey(response, "error"));
+ QDECREF(response);
+
+ response = qmp("");
+ g_assert(response);
+ g_assert(qdict_haskey(response, "event"));
+ g_assert(!strcmp(qdict_get_str(response, "event"), "DEVICE_DELETED"));
+}
+
int main(int argc, char **argv)
{
int ret;
@@ -55,8 +83,10 @@ int main(int argc, char **argv)
qtest_add_func("/uhci/pci/init", test_uhci_init);
qtest_add_func("/uhci/pci/port1", test_port_1);
qtest_add_func("/uhci/pci/hotplug", test_uhci_hotplug);
+ qtest_add_func("/uhci/pci/hotplug/usb-storage", test_usb_storage_hotplug);
qtest_start("-device piix3-usb-uhci,id=uhci,addr=1d.0"
+ " -drive id=drive0,if=none,file=/dev/null"
" -device usb-tablet,bus=uhci.0,port=1");
ret = g_test_run();
qtest_end();
--
1.8.3.1
- [Qemu-devel] [PATCH 00/30] complete conversion to hotplug-handler API, Igor Mammedov, 2014/09/24
- [Qemu-devel] [PATCH 01/30] test: virtio-scsi: check if hot-plug/unplug works, Igor Mammedov, 2014/09/24
- [Qemu-devel] [PATCH 02/30] test: virtio-serial: check if hot-plug/unplug works, Igor Mammedov, 2014/09/24
- [Qemu-devel] [PATCH 07/30] test: usb: generic usb device hotplug, Igor Mammedov, 2014/09/24
- [Qemu-devel] [PATCH 08/30] test: usb: usb-storage hotplug test,
Igor Mammedov <=
- [Qemu-devel] [PATCH 09/30] access BusState.allow_hotplug using wraper qbus_is_hotpluggable(), Igor Mammedov, 2014/09/24
- [Qemu-devel] [PATCH 10/30] qdev: HotplugHandler: rename unplug callback to unplug_request, Igor Mammedov, 2014/09/24
- [Qemu-devel] [PATCH 13/30] qdev: hotplug: set handler only if HOTPLUG_HANDLER interface is supported, Igor Mammedov, 2014/09/24