All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
@ 2014-06-17  8:03 arei.gonglei
  2014-06-17  8:03 ` [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest arei.gonglei
                   ` (5 more replies)
  0 siblings, 6 replies; 23+ messages in thread
From: arei.gonglei @ 2014-06-17  8:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: weidong.huang, luonengjun, Gonglei, kraxel, stefanha, akong, afaerber

From: Gonglei <arei.gonglei@huawei.com>

This patch series base on my request usb host adapter hotplug/unplug
series:

[PATCH v3 00/10] usb: usb host adapter hotplug
http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg00746.html

and use qmp_exec_hmp_cmd funcion introduced by Amos Kong's series:

[PATCH v4 2/4] qtest: introduce qmp_exec_hmp_cmd()
http://lists.gnu.org/archive/html/qemu-devel/2014-06/msg01678.html


Gonglei (5):
  tests: add OHCI qtest
  tests: add UHCI qtest
  tests: add xHCI qtest
  usb-hcd-ehci-test: change ehci qtest more expansively
  usb-hcd-ehci-test: add ehci hotplug/unplug qtest

 MAINTAINERS               |  2 +-
 tests/Makefile            |  9 ++++++++
 tests/usb-hcd-ehci-test.c | 53 +++++++++++++++++++++++++++++++++++------------
 tests/usb-hcd-ohci-test.c | 41 ++++++++++++++++++++++++++++++++++++
 tests/usb-hcd-uhci-test.c | 42 +++++++++++++++++++++++++++++++++++++
 tests/usb-hcd-xhci-test.c | 42 +++++++++++++++++++++++++++++++++++++
 6 files changed, 175 insertions(+), 14 deletions(-)
 create mode 100644 tests/usb-hcd-ohci-test.c
 create mode 100644 tests/usb-hcd-uhci-test.c
 create mode 100644 tests/usb-hcd-xhci-test.c

-- 
1.7.12.4

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest
  2014-06-17  8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
@ 2014-06-17  8:03 ` arei.gonglei
  2014-06-19 12:34   ` Andreas Färber
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest arei.gonglei
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: arei.gonglei @ 2014-06-17  8:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: weidong.huang, luonengjun, Gonglei, kraxel, stefanha, akong, afaerber

From: Gonglei <arei.gonglei@huawei.com>

add ohci controller hotplug/unplug qtest

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 MAINTAINERS               |  2 +-
 tests/Makefile            |  3 +++
 tests/usb-hcd-ohci-test.c | 41 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 tests/usb-hcd-ohci-test.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 51a6f51..2c81323 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -608,7 +608,7 @@ USB
 M: Gerd Hoffmann <kraxel@redhat.com>
 S: Maintained
 F: hw/usb/*
-F: tests/usb-hcd-ehci-test.c
+F: tests/usb-hcd*
 
 VFIO
 M: Alex Williamson <alex.williamson@redhat.com>
diff --git a/tests/Makefile b/tests/Makefile
index 361bb7b..b1fbfb6 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -151,6 +151,8 @@ check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
 gcov-files-i386-y += hw/pci-bridge/i82801b11.c
 check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
 gcov-files-i386-y += hw/pci-bridge/ioh3420.c
+check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
+gcov-files-i386-y += hw/usb/hcd-ohci.c
 check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/hcd-uhci.c
@@ -321,6 +323,7 @@ tests/ac97-test$(EXESUF): tests/ac97-test.o
 tests/es1370-test$(EXESUF): tests/es1370-test.o
 tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
 tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
+tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c
new file mode 100644
index 0000000..bb54346
--- /dev/null
+++ b/tests/usb-hcd-ohci-test.c
@@ -0,0 +1,41 @@
+/*
+ * QTest testcase for USB OHCI controller
+ *
+ * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+
+static void test_ohci_hotplug(void)
+{
+    qtest_start("");
+
+    /* hotplug an ohci controller */
+    qmp_exec_hmp_cmd("", "device_add pci-ohci,id=ohci");
+
+    /* hot unplug an ohci controller */
+    qmp_exec_hmp_cmd("", "device_del ohci");
+
+    qtest_end();
+}
+
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+
+    qtest_add_func("/ohci/pci/ohci-hotplug", test_ohci_hotplug);
+
+    ret = g_test_run();
+
+    return ret;
+}
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest
  2014-06-17  8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
  2014-06-17  8:03 ` [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest arei.gonglei
@ 2014-06-17  8:04 ` arei.gonglei
  2014-06-19 12:40   ` Andreas Färber
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest arei.gonglei
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: arei.gonglei @ 2014-06-17  8:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: weidong.huang, luonengjun, Gonglei, kraxel, stefanha, akong, afaerber

From: Gonglei <arei.gonglei@huawei.com>

add uhci controller hotplug/unplug qtest

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 tests/Makefile            |  3 +++
 tests/usb-hcd-uhci-test.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 tests/usb-hcd-uhci-test.c

diff --git a/tests/Makefile b/tests/Makefile
index b1fbfb6..54b8af2 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -153,6 +153,8 @@ check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
 gcov-files-i386-y += hw/pci-bridge/ioh3420.c
 check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-ohci.c
+check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
+gcov-files-i386-y += hw/usb/hcd-uhci.c
 check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/hcd-uhci.c
@@ -324,6 +326,7 @@ tests/es1370-test$(EXESUF): tests/es1370-test.o
 tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
 tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
 tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
+tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c
new file mode 100644
index 0000000..bc5c2d2
--- /dev/null
+++ b/tests/usb-hcd-uhci-test.c
@@ -0,0 +1,42 @@
+/*
+ * QTest testcase for USB UHCI controller
+ *
+ * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+
+static void test_uhci_hotplug(void)
+{
+    qtest_start("");
+
+    /* hotplug an uhci controller */
+    qmp_exec_hmp_cmd("", "device_add piix3-usb-uhci,id=uhci");
+
+    /* hot unplug an uhci controller */
+    qmp_exec_hmp_cmd("", "device_del uhci");
+
+    qtest_end();
+}
+
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+
+    qtest_add_func("/uhci/pci/uhci-hotplug", test_uhci_hotplug);
+
+    ret = g_test_run();
+
+    return ret;
+}
+
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest
  2014-06-17  8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
  2014-06-17  8:03 ` [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest arei.gonglei
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest arei.gonglei
@ 2014-06-17  8:04 ` arei.gonglei
  2014-06-19 12:37   ` Andreas Färber
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more expansively arei.gonglei
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 23+ messages in thread
From: arei.gonglei @ 2014-06-17  8:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: weidong.huang, luonengjun, Gonglei, kraxel, stefanha, akong, afaerber

From: Gonglei <arei.gonglei@huawei.com>

add xhci controller hotplug/unplug qtest

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 tests/Makefile            |  3 +++
 tests/usb-hcd-xhci-test.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+)
 create mode 100644 tests/usb-hcd-xhci-test.c

diff --git a/tests/Makefile b/tests/Makefile
index 54b8af2..f13d229 100644
--- a/tests/Makefile
+++ b/tests/Makefile
@@ -155,6 +155,8 @@ check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-ohci.c
 check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-uhci.c
+check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
+gcov-files-i386-y += hw/usb/hcd-xhci.c
 check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
 gcov-files-i386-y += hw/usb/hcd-ehci.c
 gcov-files-i386-y += hw/usb/hcd-uhci.c
@@ -327,6 +329,7 @@ tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
 tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
 tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
 tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o
+tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o
 tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
 tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
 tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
diff --git a/tests/usb-hcd-xhci-test.c b/tests/usb-hcd-xhci-test.c
new file mode 100644
index 0000000..7ffee10
--- /dev/null
+++ b/tests/usb-hcd-xhci-test.c
@@ -0,0 +1,42 @@
+/*
+ * QTest testcase for USB xHCI controller
+ *
+ * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#include <glib.h>
+#include <string.h>
+#include "libqtest.h"
+#include "qemu/osdep.h"
+
+
+static void test_xhci_hotplug(void)
+{
+    qtest_start("");
+
+    /* hotplug a xhci controller */
+    qmp_exec_hmp_cmd("", "device_add nec-usb-xhci,id=xhci");
+
+    /* hot unplug a xhci controller */
+    qmp_exec_hmp_cmd("", "device_del xhci");
+
+    qtest_end();
+}
+
+
+int main(int argc, char **argv)
+{
+    int ret;
+
+    g_test_init(&argc, &argv, NULL);
+
+    qtest_add_func("/xhci/pci/xhci-hotplug", test_xhci_hotplug);
+
+    ret = g_test_run();
+
+    return ret;
+}
+
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more expansively
  2014-06-17  8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
                   ` (2 preceding siblings ...)
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest arei.gonglei
@ 2014-06-17  8:04 ` arei.gonglei
  2014-06-19 12:55   ` Andreas Färber
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 5/5] usb-hcd-ehci-test: add ehci hotplug/unplug qtest arei.gonglei
  2014-06-19 10:05 ` [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases Gerd Hoffmann
  5 siblings, 1 reply; 23+ messages in thread
From: arei.gonglei @ 2014-06-17  8:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: weidong.huang, luonengjun, Gonglei, kraxel, stefanha, akong, afaerber

From: Gonglei <arei.gonglei@huawei.com>

For simply add a new subtest in usb-hcd-ehci-test.c,
remove qtest_start and qtest_end to an absolute method
from main function.

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 tests/usb-hcd-ehci-test.c | 38 +++++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 13 deletions(-)

diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c
index bcdf62f..e1427f5 100644
--- a/tests/usb-hcd-ehci-test.c
+++ b/tests/usb-hcd-ehci-test.c
@@ -154,32 +154,44 @@ static void pci_ehci_port_2(void)
     }
 }
 
+static void pci_qtest_start(void)
+{
+    qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7,"
+                    "multifunction=on,id=ich9-ehci-1 "
+                    "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0,"
+                    "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 "
+                    "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1,"
+                    "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 "
+                    "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2,"
+                    "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 "
+                    "-drive if=none,id=usbcdrom,media=cdrom "
+                    "-device usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 "
+                    "-device usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom ");
+
+}
+
+static void pci_qtest_stop(void)
+{
+    qtest_end();
+}
+
 int main(int argc, char **argv)
 {
     int ret;
 
     g_test_init(&argc, &argv, NULL);
+
+    /* NB: pci_qtest_start() must match with pci_qtest_stop() */
+    qtest_add_func("/ehci/pci/qtest_start", pci_qtest_start);
     qtest_add_func("/ehci/pci/init", pci_init);
     qtest_add_func("/ehci/pci/uhci-port-1", pci_uhci_port_1);
     qtest_add_func("/ehci/pci/ehci-port-1", pci_ehci_port_1);
     qtest_add_func("/ehci/pci/ehci-config", pci_ehci_config);
     qtest_add_func("/ehci/pci/uhci-port-2", pci_uhci_port_2);
     qtest_add_func("/ehci/pci/ehci-port-2", pci_ehci_port_2);
+    qtest_add_func("/ehci/pci/qtest_stop", pci_qtest_stop);
 
-    qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7,"
-                "multifunction=on,id=ich9-ehci-1 "
-                "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0,"
-                "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 "
-                "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1,"
-                "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 "
-                "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2,"
-                "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 "
-                "-drive if=none,id=usbcdrom,media=cdrom "
-                "-device usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 "
-                "-device usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom ");
     ret = g_test_run();
 
-    qtest_end();
-
     return ret;
 }
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 5/5] usb-hcd-ehci-test: add ehci hotplug/unplug qtest
  2014-06-17  8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
                   ` (3 preceding siblings ...)
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more expansively arei.gonglei
@ 2014-06-17  8:04 ` arei.gonglei
  2014-06-19 10:05 ` [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases Gerd Hoffmann
  5 siblings, 0 replies; 23+ messages in thread
From: arei.gonglei @ 2014-06-17  8:04 UTC (permalink / raw)
  To: qemu-devel
  Cc: weidong.huang, luonengjun, Gonglei, kraxel, stefanha, akong, afaerber

From: Gonglei <arei.gonglei@huawei.com>

Signed-off-by: Gonglei <arei.gonglei@huawei.com>
---
 tests/usb-hcd-ehci-test.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c
index e1427f5..831e868 100644
--- a/tests/usb-hcd-ehci-test.c
+++ b/tests/usb-hcd-ehci-test.c
@@ -175,6 +175,19 @@ static void pci_qtest_stop(void)
     qtest_end();
 }
 
+static void test_ehci_hotplug(void)
+{
+    qtest_start("");
+
+    /* hotplug an ehci controller */
+    qmp_exec_hmp_cmd("", "device_add usb-ehci,id=ehci");
+
+    /* hot unplug an ehci controller */
+    qmp_exec_hmp_cmd("", "device_del ehci");
+
+    qtest_end();
+}
+
 int main(int argc, char **argv)
 {
     int ret;
@@ -191,6 +204,8 @@ int main(int argc, char **argv)
     qtest_add_func("/ehci/pci/ehci-port-2", pci_ehci_port_2);
     qtest_add_func("/ehci/pci/qtest_stop", pci_qtest_stop);
 
+    qtest_add_func("/ehci/pci/ehci-hotplug", test_ehci_hotplug);
+
     ret = g_test_run();
 
     return ret;
-- 
1.7.12.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-17  8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
                   ` (4 preceding siblings ...)
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 5/5] usb-hcd-ehci-test: add ehci hotplug/unplug qtest arei.gonglei
@ 2014-06-19 10:05 ` Gerd Hoffmann
  2014-06-19 12:18   ` Gonglei (Arei)
  2014-06-19 12:24   ` Andreas Färber
  5 siblings, 2 replies; 23+ messages in thread
From: Gerd Hoffmann @ 2014-06-19 10:05 UTC (permalink / raw)
  To: arei.gonglei
  Cc: weidong.huang, luonengjun, qemu-devel, stefanha, akong, afaerber

  Hi,

> Gonglei (5):
>   tests: add OHCI qtest
>   tests: add UHCI qtest
>   tests: add xHCI qtest
>   usb-hcd-ehci-test: change ehci qtest more expansively
>   usb-hcd-ehci-test: add ehci hotplug/unplug qtest

I'd prefer to leave the usb-hcd-ehci-test alone.  Maybe rename to
"usb-hcd-ehci-companion-test" to make room for a new usb-hcd-ehci-test
for the standalone ehic test.

I also suggest to hot-plug some usb device into the host adapter.  Some
hid device is probably easiest.  Then unplug host-adapter without
unplugging the usb device beforehand.

Also "make check" fails for me:

GTESTER tests/test-vmstate
GTESTER tests/test-qemu-opts
GTESTER check-qtest-x86_64
blkdebug: Suspended request 'A'
blkdebug: Resuming request 'A'
main-loop: WARNING: I/O thread spun for 1000 iterations
acpi-test: Warning! DSDT mismatch. Actual [asl:/tmp/asl-GQ9SHX.dsl,
aml:/tmp/aml-GI9SHX], Expected [asl:/tmp/asl-FY4SHX.dsl,
aml:tests/acpi-test-data/pc/DSDT].
acpi-test: Warning! SSDT mismatch. Actual [asl:/tmp/asl-F4ITHX.dsl,
aml:/tmp/aml-6M9SHX], Expected [asl:/tmp/asl-H9LSHX.dsl,
aml:tests/acpi-test-data/pc/SSDT].
main-loop: WARNING: I/O thread spun for 1000 iterations
acpi-test: Warning! DSDT mismatch. Actual [asl:/tmp/asl-7NI2HX.dsl,
aml:/tmp/aml-4UG2HX], Expected [asl:/tmp/asl-LE71HX.dsl,
aml:tests/acpi-test-data/q35/DSDT].
acpi-test: Warning! SSDT mismatch. Actual [asl:/tmp/asl-40M2HX.dsl,
aml:/tmp/aml-YZG2HX], Expected [asl:/tmp/asl-LJL4HX.dsl,
aml:tests/acpi-test-data/q35/SSDT].
[vmxnet3][WR][vmxnet3_peer_has_vnet_hdr]: Peer has no virtio extension.
Task offloads will be emulated.
**
ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cmd:
assertion failed: (response_return)
GTester: last random seed: R02S88e3bbe1d1db1bc8f97f72f791c3610a
**
ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cmd:
assertion failed: (response_return)
GTester: last random seed: R02S3e505ce96a4bf0db48dbe98e31037359
**
ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cmd:
assertion failed: (response_return)
GTester: last random seed: R02S09d78c5751122dc043d2c9e0896b9efa
**
ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cmd:
assertion failed: (response_return)
GTester: last random seed: R02S61a33eb223796b0573353669f80c6431
make: *** [check-qtest-x86_64] Error 1
test failure

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 10:05 ` [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases Gerd Hoffmann
@ 2014-06-19 12:18   ` Gonglei (Arei)
  2014-06-19 12:24   ` Andreas Färber
  1 sibling, 0 replies; 23+ messages in thread
From: Gonglei (Arei) @ 2014-06-19 12:18 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Huangweidong (C), Luonengjun, qemu-devel, stefanha, akong, afaerber

> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Thursday, June 19, 2014 6:05 PM
> To: Gonglei (Arei)
> Cc: qemu-devel@nongnu.org; afaerber@suse.de; stefanha@redhat.com;
> eblake@redhat.com; akong@redhat.com; Huangweidong (C); Luonengjun
> Subject: Re: [PATCH 0/5] tests: add usb host adapter qtest cases
> 
>   Hi,
> 
> > Gonglei (5):
> >   tests: add OHCI qtest
> >   tests: add UHCI qtest
> >   tests: add xHCI qtest
> >   usb-hcd-ehci-test: change ehci qtest more expansively
> >   usb-hcd-ehci-test: add ehci hotplug/unplug qtest
> 
> I'd prefer to leave the usb-hcd-ehci-test alone.  Maybe rename to
> "usb-hcd-ehci-companion-test" to make room for a new usb-hcd-ehci-test
> for the standalone ehic test.
> 
OK, good idea! 

> I also suggest to hot-plug some usb device into the host adapter.  Some
> hid device is probably easiest.  Then unplug host-adapter without
> unplugging the usb device beforehand.
>
OK.

I will do those in the next version, thanks for your review!
 
> Also "make check" fails for me:
> 
> GTESTER tests/test-vmstate
> GTESTER tests/test-qemu-opts
> GTESTER check-qtest-x86_64
> blkdebug: Suspended request 'A'
> blkdebug: Resuming request 'A'
> main-loop: WARNING: I/O thread spun for 1000 iterations
> acpi-test: Warning! DSDT mismatch. Actual [asl:/tmp/asl-GQ9SHX.dsl,
> aml:/tmp/aml-GI9SHX], Expected [asl:/tmp/asl-FY4SHX.dsl,
> aml:tests/acpi-test-data/pc/DSDT].
> acpi-test: Warning! SSDT mismatch. Actual [asl:/tmp/asl-F4ITHX.dsl,
> aml:/tmp/aml-6M9SHX], Expected [asl:/tmp/asl-H9LSHX.dsl,
> aml:tests/acpi-test-data/pc/SSDT].
> main-loop: WARNING: I/O thread spun for 1000 iterations
> acpi-test: Warning! DSDT mismatch. Actual [asl:/tmp/asl-7NI2HX.dsl,
> aml:/tmp/aml-4UG2HX], Expected [asl:/tmp/asl-LE71HX.dsl,
> aml:tests/acpi-test-data/q35/DSDT].
> acpi-test: Warning! SSDT mismatch. Actual [asl:/tmp/asl-40M2HX.dsl,
> aml:/tmp/aml-YZG2HX], Expected [asl:/tmp/asl-LJL4HX.dsl,
> aml:tests/acpi-test-data/q35/SSDT].
> [vmxnet3][WR][vmxnet3_peer_has_vnet_hdr]: Peer has no virtio extension.
> Task offloads will be emulated.
> **
> ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cm
> d:
> assertion failed: (response_return)
> GTester: last random seed: R02S88e3bbe1d1db1bc8f97f72f791c3610a
> **
> ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cm
> d:
> assertion failed: (response_return)
> GTester: last random seed: R02S3e505ce96a4bf0db48dbe98e31037359
> **
> ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cm
> d:
> assertion failed: (response_return)
> GTester: last random seed: R02S09d78c5751122dc043d2c9e0896b9efa
> **
> ERROR:/home/kraxel/projects/qemu/tests/libqtest.c:668:qmp_exec_hmp_cm
> d:
> assertion failed: (response_return)
> GTester: last random seed: R02S61a33eb223796b0573353669f80c6431
> make: *** [check-qtest-x86_64] Error 1
> test failure
> 
> cheers,
>   Gerd
> 
Gerd, I haven't encounter this issue.

Would you use "make check V=1" for more details, thanks.

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 10:05 ` [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases Gerd Hoffmann
  2014-06-19 12:18   ` Gonglei (Arei)
@ 2014-06-19 12:24   ` Andreas Färber
  2014-06-19 12:47     ` Gerd Hoffmann
  1 sibling, 1 reply; 23+ messages in thread
From: Andreas Färber @ 2014-06-19 12:24 UTC (permalink / raw)
  To: Gerd Hoffmann, arei.gonglei
  Cc: weidong.huang, luonengjun, qemu-devel, stefanha, akong

Hi Gerd,

Am 19.06.2014 12:05, schrieb Gerd Hoffmann:
>> Gonglei (5):
>>   tests: add OHCI qtest
>>   tests: add UHCI qtest
>>   tests: add xHCI qtest
>>   usb-hcd-ehci-test: change ehci qtest more expansively
>>   usb-hcd-ehci-test: add ehci hotplug/unplug qtest
> 
> I'd prefer to leave the usb-hcd-ehci-test alone.

Why? My idea was to put all EHCI testing code into that ehci file. This
is so that any defines or helper functions can be shared within the
file. Functional testing of the companion core should go into the
respective *hci file, unless there is some interaction to test.

Just because right now most test files are pretty empty doesn't mean
they need to stay that way.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest
  2014-06-17  8:03 ` [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest arei.gonglei
@ 2014-06-19 12:34   ` Andreas Färber
  2014-06-19 12:48     ` Gonglei (Arei)
  0 siblings, 1 reply; 23+ messages in thread
From: Andreas Färber @ 2014-06-19 12:34 UTC (permalink / raw)
  To: arei.gonglei, qemu-devel
  Cc: luonengjun, akong, weidong.huang, kraxel, stefanha

Am 17.06.2014 10:03, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> add ohci controller hotplug/unplug qtest
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  MAINTAINERS               |  2 +-
>  tests/Makefile            |  3 +++
>  tests/usb-hcd-ohci-test.c | 41 +++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 45 insertions(+), 1 deletion(-)
>  create mode 100644 tests/usb-hcd-ohci-test.c
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 51a6f51..2c81323 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -608,7 +608,7 @@ USB
>  M: Gerd Hoffmann <kraxel@redhat.com>
>  S: Maintained
>  F: hw/usb/*
> -F: tests/usb-hcd-ehci-test.c
> +F: tests/usb-hcd*

usb-*-test.c?

>  
>  VFIO
>  M: Alex Williamson <alex.williamson@redhat.com>
> diff --git a/tests/Makefile b/tests/Makefile
> index 361bb7b..b1fbfb6 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -151,6 +151,8 @@ check-qtest-i386-y += tests/i82801b11-test$(EXESUF)
>  gcov-files-i386-y += hw/pci-bridge/i82801b11.c
>  check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
>  gcov-files-i386-y += hw/pci-bridge/ioh3420.c
> +check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
> +gcov-files-i386-y += hw/usb/hcd-ohci.c
>  check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
>  gcov-files-i386-y += hw/usb/hcd-ehci.c
>  gcov-files-i386-y += hw/usb/hcd-uhci.c
> @@ -321,6 +323,7 @@ tests/ac97-test$(EXESUF): tests/ac97-test.o
>  tests/es1370-test$(EXESUF): tests/es1370-test.o
>  tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
>  tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
> +tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
>  tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
>  tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
>  tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a
> diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c
> new file mode 100644
> index 0000000..bb54346
> --- /dev/null
> +++ b/tests/usb-hcd-ohci-test.c
> @@ -0,0 +1,41 @@
> +/*
> + * QTest testcase for USB OHCI controller
> + *
> + * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
> + *
> + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> + * See the COPYING file in the top-level directory.
> + */
> +
> +#include <glib.h>
> +#include <string.h>
> +#include "libqtest.h"
> +#include "qemu/osdep.h"
> +
> +
> +static void test_ohci_hotplug(void)
> +{
> +    qtest_start("");
> +
> +    /* hotplug an ohci controller */
> +    qmp_exec_hmp_cmd("", "device_add pci-ohci,id=ohci");
> +
> +    /* hot unplug an ohci controller */
> +    qmp_exec_hmp_cmd("", "device_del ohci");

Please use QMP for device_add/del, it's safer with regards to response
parsing.

> +
> +    qtest_end();
> +}
> +
> +
> +int main(int argc, char **argv)
> +{
> +    int ret;
> +
> +    g_test_init(&argc, &argv, NULL);
> +
> +    qtest_add_func("/ohci/pci/ohci-hotplug", test_ohci_hotplug);

Might it make sense to also include a traditional "cold-plug" test? It
could be reused for ppc64 (sPAPR), where the q35 companion-controller
snippet probably doesn't apply.

> +
> +    ret = g_test_run();
> +
> +    return ret;
> +}

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest arei.gonglei
@ 2014-06-19 12:37   ` Andreas Färber
  2014-06-19 12:57     ` Gonglei (Arei)
  0 siblings, 1 reply; 23+ messages in thread
From: Andreas Färber @ 2014-06-19 12:37 UTC (permalink / raw)
  To: arei.gonglei, qemu-devel
  Cc: luonengjun, akong, weidong.huang, kraxel, stefanha

Am 17.06.2014 10:04, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> add xhci controller hotplug/unplug qtest
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  tests/Makefile            |  3 +++
>  tests/usb-hcd-xhci-test.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
>  create mode 100644 tests/usb-hcd-xhci-test.c
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index 54b8af2..f13d229 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -155,6 +155,8 @@ check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
>  gcov-files-i386-y += hw/usb/hcd-ohci.c
>  check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
>  gcov-files-i386-y += hw/usb/hcd-uhci.c
> +check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
> +gcov-files-i386-y += hw/usb/hcd-xhci.c
>  check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
>  gcov-files-i386-y += hw/usb/hcd-ehci.c
>  gcov-files-i386-y += hw/usb/hcd-uhci.c
> @@ -327,6 +329,7 @@ tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
>  tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
>  tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
>  tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o
> +tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o
>  tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-pc-obj-y)
>  tests/qemu-iotests/socket_scm_helper$(EXESUF): tests/qemu-iotests/socket_scm_helper.o
>  tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a libqemustub.a

Nitpick: Maybe order xhci after ehci in both cases? Then we have 1.x /
2.0 / 3.0 ordering.

Same comments wrt QMP and -device testing apply.

Cheers,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest arei.gonglei
@ 2014-06-19 12:40   ` Andreas Färber
  2014-06-19 12:59     ` Gonglei (Arei)
  0 siblings, 1 reply; 23+ messages in thread
From: Andreas Färber @ 2014-06-19 12:40 UTC (permalink / raw)
  To: arei.gonglei, qemu-devel
  Cc: luonengjun, akong, weidong.huang, kraxel, stefanha

Am 17.06.2014 10:04, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> add uhci controller hotplug/unplug qtest
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  tests/Makefile            |  3 +++
>  tests/usb-hcd-uhci-test.c | 42 ++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 45 insertions(+)
>  create mode 100644 tests/usb-hcd-uhci-test.c
> 
> diff --git a/tests/Makefile b/tests/Makefile
> index b1fbfb6..54b8af2 100644
> --- a/tests/Makefile
> +++ b/tests/Makefile
> @@ -153,6 +153,8 @@ check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
>  gcov-files-i386-y += hw/pci-bridge/ioh3420.c
>  check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
>  gcov-files-i386-y += hw/usb/hcd-ohci.c
> +check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
> +gcov-files-i386-y += hw/usb/hcd-uhci.c
>  check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
>  gcov-files-i386-y += hw/usb/hcd-ehci.c

>  gcov-files-i386-y += hw/usb/hcd-uhci.c

You can drop this duplicate line then.

Again, QMP and -device testing would be nice.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 12:24   ` Andreas Färber
@ 2014-06-19 12:47     ` Gerd Hoffmann
  2014-06-19 13:07       ` Andreas Färber
  0 siblings, 1 reply; 23+ messages in thread
From: Gerd Hoffmann @ 2014-06-19 12:47 UTC (permalink / raw)
  To: Andreas Färber
  Cc: weidong.huang, luonengjun, qemu-devel, arei.gonglei, stefanha, akong

On Do, 2014-06-19 at 14:24 +0200, Andreas Färber wrote:
> Hi Gerd,
> 
> Am 19.06.2014 12:05, schrieb Gerd Hoffmann:
> >> Gonglei (5):
> >>   tests: add OHCI qtest
> >>   tests: add UHCI qtest
> >>   tests: add xHCI qtest
> >>   usb-hcd-ehci-test: change ehci qtest more expansively
> >>   usb-hcd-ehci-test: add ehci hotplug/unplug qtest
> > 
> > I'd prefer to leave the usb-hcd-ehci-test alone.
> 
> Why? My idea was to put all EHCI testing code into that ehci file. This
> is so that any defines or helper functions can be shared within the
> file. Functional testing of the companion core should go into the
> respective *hci file, unless there is some interaction to test.

The hotplugging and the tests currently in usb-hcd-ehci-test are quite
different.  Hotplugging creates a empty machine, then plugs + unplugs
stuff.  usb-hcd-ehci-test creates a machine with ehci+ohci companions,
then goes run a bunch of tests for it.

Maybe it makes sense to have a usb-hcd-hotplug-test.c file and collect
hotplug testing for all usb hcds we have there.  For code sharing
that'll be better for sure as the basic code flow is the same for all
hcd types.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest
  2014-06-19 12:34   ` Andreas Färber
@ 2014-06-19 12:48     ` Gonglei (Arei)
  0 siblings, 0 replies; 23+ messages in thread
From: Gonglei (Arei) @ 2014-06-19 12:48 UTC (permalink / raw)
  To: Andreas Färber, qemu-devel
  Cc: Luonengjun, akong, Huangweidong (C), kraxel, stefanha

> -----Original Message-----
> From: Andreas Färber [mailto:afaerber@suse.de]
> Sent: Thursday, June 19, 2014 8:35 PM
> To: Gonglei (Arei); qemu-devel@nongnu.org
> Cc: Huangweidong (C); Luonengjun; kraxel@redhat.com;
> stefanha@redhat.com; akong@redhat.com
> Subject: Re: [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest
> 
> Am 17.06.2014 10:03, schrieb arei.gonglei@huawei.com:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > add ohci controller hotplug/unplug qtest
> >
> > Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> > ---
> >  MAINTAINERS               |  2 +-
> >  tests/Makefile            |  3 +++
> >  tests/usb-hcd-ohci-test.c | 41
> +++++++++++++++++++++++++++++++++++++++++
> >  3 files changed, 45 insertions(+), 1 deletion(-)
> >  create mode 100644 tests/usb-hcd-ohci-test.c
> >
> > diff --git a/MAINTAINERS b/MAINTAINERS
> > index 51a6f51..2c81323 100644
> > --- a/MAINTAINERS
> > +++ b/MAINTAINERS
> > @@ -608,7 +608,7 @@ USB
> >  M: Gerd Hoffmann <kraxel@redhat.com>
> >  S: Maintained
> >  F: hw/usb/*
> > -F: tests/usb-hcd-ehci-test.c
> > +F: tests/usb-hcd*
> 
> usb-*-test.c?
> 
OK, it's better.

> >
> >  VFIO
> >  M: Alex Williamson <alex.williamson@redhat.com>
> > diff --git a/tests/Makefile b/tests/Makefile
> > index 361bb7b..b1fbfb6 100644
> > --- a/tests/Makefile
> > +++ b/tests/Makefile
> > @@ -151,6 +151,8 @@ check-qtest-i386-y +=
> tests/i82801b11-test$(EXESUF)
> >  gcov-files-i386-y += hw/pci-bridge/i82801b11.c
> >  check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
> >  gcov-files-i386-y += hw/pci-bridge/ioh3420.c
> > +check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
> > +gcov-files-i386-y += hw/usb/hcd-ohci.c
> >  check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
> >  gcov-files-i386-y += hw/usb/hcd-ehci.c
> >  gcov-files-i386-y += hw/usb/hcd-uhci.c
> > @@ -321,6 +323,7 @@ tests/ac97-test$(EXESUF): tests/ac97-test.o
> >  tests/es1370-test$(EXESUF): tests/es1370-test.o
> >  tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
> >  tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
> > +tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
> >  tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o
> $(libqos-pc-obj-y)
> >  tests/qemu-iotests/socket_scm_helper$(EXESUF):
> tests/qemu-iotests/socket_scm_helper.o
> >  tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a
> libqemustub.a
> > diff --git a/tests/usb-hcd-ohci-test.c b/tests/usb-hcd-ohci-test.c
> > new file mode 100644
> > index 0000000..bb54346
> > --- /dev/null
> > +++ b/tests/usb-hcd-ohci-test.c
> > @@ -0,0 +1,41 @@
> > +/*
> > + * QTest testcase for USB OHCI controller
> > + *
> > + * Copyright (c) 2014 HUAWEI TECHNOLOGIES CO.,LTD.
> > + *
> > + * This work is licensed under the terms of the GNU GPL, version 2 or later.
> > + * See the COPYING file in the top-level directory.
> > + */
> > +
> > +#include <glib.h>
> > +#include <string.h>
> > +#include "libqtest.h"
> > +#include "qemu/osdep.h"
> > +
> > +
> > +static void test_ohci_hotplug(void)
> > +{
> > +    qtest_start("");
> > +
> > +    /* hotplug an ohci controller */
> > +    qmp_exec_hmp_cmd("", "device_add pci-ohci,id=ohci");
> > +
> > +    /* hot unplug an ohci controller */
> > +    qmp_exec_hmp_cmd("", "device_del ohci");
> 
> Please use QMP for device_add/del, it's safer with regards to response
> parsing.
> 
OK.

> > +
> > +    qtest_end();
> > +}
> > +
> > +
> > +int main(int argc, char **argv)
> > +{
> > +    int ret;
> > +
> > +    g_test_init(&argc, &argv, NULL);
> > +
> > +    qtest_add_func("/ohci/pci/ohci-hotplug", test_ohci_hotplug);
> 
> Might it make sense to also include a traditional "cold-plug" test?
Agreed.

> It could be reused for ppc64 (sPAPR), where the q35 companion-controller
> snippet probably doesn't apply.
> 
Yep, q35 use PCIE, which does not support hotplugging at present.


Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more expansively
  2014-06-17  8:04 ` [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more expansively arei.gonglei
@ 2014-06-19 12:55   ` Andreas Färber
  0 siblings, 0 replies; 23+ messages in thread
From: Andreas Färber @ 2014-06-19 12:55 UTC (permalink / raw)
  To: arei.gonglei, qemu-devel
  Cc: luonengjun, akong, weidong.huang, kraxel, stefanha

Am 17.06.2014 10:04, schrieb arei.gonglei@huawei.com:
> From: Gonglei <arei.gonglei@huawei.com>
> 
> For simply add a new subtest in usb-hcd-ehci-test.c,
> remove qtest_start and qtest_end to an absolute method
> from main function.
> 
> Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> ---
>  tests/usb-hcd-ehci-test.c | 38 +++++++++++++++++++++++++-------------
>  1 file changed, 25 insertions(+), 13 deletions(-)
> 
> diff --git a/tests/usb-hcd-ehci-test.c b/tests/usb-hcd-ehci-test.c
> index bcdf62f..e1427f5 100644
> --- a/tests/usb-hcd-ehci-test.c
> +++ b/tests/usb-hcd-ehci-test.c
> @@ -154,32 +154,44 @@ static void pci_ehci_port_2(void)
>      }
>  }
>  
> +static void pci_qtest_start(void)
> +{
> +    qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7,"
> +                    "multifunction=on,id=ich9-ehci-1 "
> +                    "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0,"
> +                    "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 "
> +                    "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1,"
> +                    "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 "
> +                    "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2,"
> +                    "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 "
> +                    "-drive if=none,id=usbcdrom,media=cdrom "
> +                    "-device usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 "
> +                    "-device usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom ");
> +
> +}
> +
> +static void pci_qtest_stop(void)
> +{
> +    qtest_end();
> +}
> +
>  int main(int argc, char **argv)
>  {
>      int ret;
>  
>      g_test_init(&argc, &argv, NULL);
> +
> +    /* NB: pci_qtest_start() must match with pci_qtest_stop() */
> +    qtest_add_func("/ehci/pci/qtest_start", pci_qtest_start);
>      qtest_add_func("/ehci/pci/init", pci_init);
>      qtest_add_func("/ehci/pci/uhci-port-1", pci_uhci_port_1);
>      qtest_add_func("/ehci/pci/ehci-port-1", pci_ehci_port_1);
>      qtest_add_func("/ehci/pci/ehci-config", pci_ehci_config);
>      qtest_add_func("/ehci/pci/uhci-port-2", pci_uhci_port_2);
>      qtest_add_func("/ehci/pci/ehci-port-2", pci_ehci_port_2);
> +    qtest_add_func("/ehci/pci/qtest_stop", pci_qtest_stop);

This is wrong, see
https://developer.gnome.org/glib/stable/glib-Testing.html#g-test-run

Look for g_test_add() and similar functions that allow to specify proper
setup and teardown functions with ordering guarantees.

Do note that when using g_test_* functions directly, the QEMU
architecture needs to be prepended to the path manually.

Regards,
Andreas

>  
> -    qtest_start("-machine q35 -device ich9-usb-ehci1,bus=pcie.0,addr=1d.7,"
> -                "multifunction=on,id=ich9-ehci-1 "
> -                "-device ich9-usb-uhci1,bus=pcie.0,addr=1d.0,"
> -                "multifunction=on,masterbus=ich9-ehci-1.0,firstport=0 "
> -                "-device ich9-usb-uhci2,bus=pcie.0,addr=1d.1,"
> -                "multifunction=on,masterbus=ich9-ehci-1.0,firstport=2 "
> -                "-device ich9-usb-uhci3,bus=pcie.0,addr=1d.2,"
> -                "multifunction=on,masterbus=ich9-ehci-1.0,firstport=4 "
> -                "-drive if=none,id=usbcdrom,media=cdrom "
> -                "-device usb-tablet,bus=ich9-ehci-1.0,port=1,usb_version=1 "
> -                "-device usb-storage,bus=ich9-ehci-1.0,port=2,drive=usbcdrom ");
>      ret = g_test_run();
>  
> -    qtest_end();
> -
>      return ret;
>  }
> 

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest
  2014-06-19 12:37   ` Andreas Färber
@ 2014-06-19 12:57     ` Gonglei (Arei)
  0 siblings, 0 replies; 23+ messages in thread
From: Gonglei (Arei) @ 2014-06-19 12:57 UTC (permalink / raw)
  To: Andreas Färber, qemu-devel
  Cc: Luonengjun, akong, Huangweidong (C), kraxel, stefanha

> -----Original Message-----
> From: Andreas Färber [mailto:afaerber@suse.de]
> Sent: Thursday, June 19, 2014 8:38 PM
> To: Gonglei (Arei); qemu-devel@nongnu.org
> Cc: Huangweidong (C); Luonengjun; kraxel@redhat.com;
> stefanha@redhat.com; akong@redhat.com
> Subject: Re: [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest
> 
> Am 17.06.2014 10:04, schrieb arei.gonglei@huawei.com:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > add xhci controller hotplug/unplug qtest
> >
> > Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> > ---
> >  tests/Makefile            |  3 +++
> >  tests/usb-hcd-xhci-test.c | 42
> ++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 45 insertions(+)
> >  create mode 100644 tests/usb-hcd-xhci-test.c
> >
> > diff --git a/tests/Makefile b/tests/Makefile
> > index 54b8af2..f13d229 100644
> > --- a/tests/Makefile
> > +++ b/tests/Makefile
> > @@ -155,6 +155,8 @@ check-qtest-i386-y +=
> tests/usb-hcd-ohci-test$(EXESUF)
> >  gcov-files-i386-y += hw/usb/hcd-ohci.c
> >  check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
> >  gcov-files-i386-y += hw/usb/hcd-uhci.c
> > +check-qtest-i386-y += tests/usb-hcd-xhci-test$(EXESUF)
> > +gcov-files-i386-y += hw/usb/hcd-xhci.c
> >  check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
> >  gcov-files-i386-y += hw/usb/hcd-ehci.c
> >  gcov-files-i386-y += hw/usb/hcd-uhci.c
> > @@ -327,6 +329,7 @@ tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
> >  tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
> >  tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o
> >  tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o
> > +tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o
> >  tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o
> $(libqos-pc-obj-y)
> >  tests/qemu-iotests/socket_scm_helper$(EXESUF):
> tests/qemu-iotests/socket_scm_helper.o
> >  tests/test-qemu-opts$(EXESUF): tests/test-qemu-opts.o libqemuutil.a
> libqemustub.a
> 
> Nitpick: Maybe order xhci after ehci in both cases? Then we have 1.x /
> 2.0 / 3.0 ordering.
> 
Hah... agree.

> Same comments wrt QMP and -device testing apply.
> 
OK. Thanks.

> Cheers,
> Andreas
> 
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest
  2014-06-19 12:40   ` Andreas Färber
@ 2014-06-19 12:59     ` Gonglei (Arei)
  0 siblings, 0 replies; 23+ messages in thread
From: Gonglei (Arei) @ 2014-06-19 12:59 UTC (permalink / raw)
  To: Andreas Färber, qemu-devel
  Cc: Luonengjun, akong, Huangweidong (C), kraxel, stefanha

> -----Original Message-----
> From: Andreas Färber [mailto:afaerber@suse.de]
> Sent: Thursday, June 19, 2014 8:41 PM
> To: Gonglei (Arei); qemu-devel@nongnu.org
> Cc: Huangweidong (C); Luonengjun; kraxel@redhat.com;
> stefanha@redhat.com; akong@redhat.com
> Subject: Re: [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest
> 
> Am 17.06.2014 10:04, schrieb arei.gonglei@huawei.com:
> > From: Gonglei <arei.gonglei@huawei.com>
> >
> > add uhci controller hotplug/unplug qtest
> >
> > Signed-off-by: Gonglei <arei.gonglei@huawei.com>
> > ---
> >  tests/Makefile            |  3 +++
> >  tests/usb-hcd-uhci-test.c | 42
> ++++++++++++++++++++++++++++++++++++++++++
> >  2 files changed, 45 insertions(+)
> >  create mode 100644 tests/usb-hcd-uhci-test.c
> >
> > diff --git a/tests/Makefile b/tests/Makefile
> > index b1fbfb6..54b8af2 100644
> > --- a/tests/Makefile
> > +++ b/tests/Makefile
> > @@ -153,6 +153,8 @@ check-qtest-i386-y += tests/ioh3420-test$(EXESUF)
> >  gcov-files-i386-y += hw/pci-bridge/ioh3420.c
> >  check-qtest-i386-y += tests/usb-hcd-ohci-test$(EXESUF)
> >  gcov-files-i386-y += hw/usb/hcd-ohci.c
> > +check-qtest-i386-y += tests/usb-hcd-uhci-test$(EXESUF)
> > +gcov-files-i386-y += hw/usb/hcd-uhci.c
> >  check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
> >  gcov-files-i386-y += hw/usb/hcd-ehci.c
> 
> >  gcov-files-i386-y += hw/usb/hcd-uhci.c
> 
> You can drop this duplicate line then.
> 
OK, got it.

> Again, QMP and -device testing would be nice.
> 
OK.

> Regards,
> Andreas
> 
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 12:47     ` Gerd Hoffmann
@ 2014-06-19 13:07       ` Andreas Färber
  2014-06-19 13:19         ` Gonglei (Arei)
  0 siblings, 1 reply; 23+ messages in thread
From: Andreas Färber @ 2014-06-19 13:07 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: weidong.huang, luonengjun, qemu-devel, arei.gonglei, stefanha, akong

Am 19.06.2014 14:47, schrieb Gerd Hoffmann:
> Maybe it makes sense to have a usb-hcd-hotplug-test.c file and collect
> hotplug testing for all usb hcds we have there.  For code sharing
> that'll be better for sure as the basic code flow is the same for all
> hcd types.

Ah yes, seeing that there is a "global" QEMU instance in 4/5, that may
make more sense.

OTOH hot-plug testing is a recurring topic for all PCI devices and won't
work in general (e.g., virtio-blk needs drive), but maybe we can factor
out some helpers to a .h file.

Cheers,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 13:07       ` Andreas Färber
@ 2014-06-19 13:19         ` Gonglei (Arei)
  2014-06-19 13:33           ` Andreas Färber
  0 siblings, 1 reply; 23+ messages in thread
From: Gonglei (Arei) @ 2014-06-19 13:19 UTC (permalink / raw)
  To: Andreas Färber, Gerd Hoffmann
  Cc: Huangweidong (C), Luonengjun, qemu-devel, stefanha, akong

> -----Original Message-----
> From: Andreas Färber [mailto:afaerber@suse.de]
> Sent: Thursday, June 19, 2014 9:07 PM
> To: Gerd Hoffmann
> Cc: Gonglei (Arei); qemu-devel@nongnu.org; stefanha@redhat.com;
> eblake@redhat.com; akong@redhat.com; Huangweidong (C); Luonengjun
> Subject: Re: [PATCH 0/5] tests: add usb host adapter qtest cases
> 
> Am 19.06.2014 14:47, schrieb Gerd Hoffmann:
> > Maybe it makes sense to have a usb-hcd-hotplug-test.c file and collect
> > hotplug testing for all usb hcds we have there.  For code sharing
> > that'll be better for sure as the basic code flow is the same for all
> > hcd types.
> 
> Ah yes, seeing that there is a "global" QEMU instance in 4/5, that may
> make more sense.
> 
Hi, Gerd and Andreas,

Can we reach a consensus on this issue?

> OTOH hot-plug testing is a recurring topic for all PCI devices and won't
> work in general (e.g., virtio-blk needs drive), 
Yep.

>but maybe we can factor out some helpers to a .h file.
> 
Such as... ? Thanks.

> Cheers,
> Andreas
> 
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 13:19         ` Gonglei (Arei)
@ 2014-06-19 13:33           ` Andreas Färber
  2014-06-19 13:46             ` Gerd Hoffmann
  2014-06-20  1:48             ` Gonglei (Arei)
  0 siblings, 2 replies; 23+ messages in thread
From: Andreas Färber @ 2014-06-19 13:33 UTC (permalink / raw)
  To: Gonglei (Arei)
  Cc: Huangweidong (C), Luonengjun, qemu-devel, Gerd Hoffmann, stefanha, akong

Hi Gonglei,

Am 19.06.2014 15:19, schrieb Gonglei (Arei):
>> -----Original Message-----
>> From: Andreas Färber [mailto:afaerber@suse.de]
>> Sent: Thursday, June 19, 2014 9:07 PM
>> To: Gerd Hoffmann
>> Cc: Gonglei (Arei); qemu-devel@nongnu.org; stefanha@redhat.com;
>> eblake@redhat.com; akong@redhat.com; Huangweidong (C); Luonengjun
>> Subject: Re: [PATCH 0/5] tests: add usb host adapter qtest cases
>>
>> Am 19.06.2014 14:47, schrieb Gerd Hoffmann:
>>> Maybe it makes sense to have a usb-hcd-hotplug-test.c file and collect
>>> hotplug testing for all usb hcds we have there.  For code sharing
>>> that'll be better for sure as the basic code flow is the same for all
>>> hcd types.
>>
>> Ah yes, seeing that there is a "global" QEMU instance in 4/5, that may
>> make more sense.
>>
> Hi, Gerd and Andreas,
> 
> Can we reach a consensus on this issue?

IMO it does not make sense to create a new ehci-hotplug file that will
only ever contain one test. Collecting all HCD hotplug tests into one
hcd-hotplug file, as Gerd suggested, would be fine with me. We'll still
need your hci-{ohci,uhci,xhci} files for functional (PCI/MMIO) tests and
what I referred to as "cold-plug" or init testing though.

>> OTOH hot-plug testing is a recurring topic for all PCI devices and won't
>> work in general (e.g., virtio-blk needs drive), 
> Yep.
> 
>> but maybe we can factor out some helpers to a .h file.
>>
> Such as... ?

Can't tell what Gerd had in mind for hcd hotplug sharing, but I was
thinking of some wrappers for the device_add and device_del commands.
Not sure if that makes sense in practice. Probably best start without
such a header and later we can see if there is much recurring code to be
factored out.

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 13:33           ` Andreas Färber
@ 2014-06-19 13:46             ` Gerd Hoffmann
  2014-06-20  1:51               ` Gonglei (Arei)
  2014-06-20  1:48             ` Gonglei (Arei)
  1 sibling, 1 reply; 23+ messages in thread
From: Gerd Hoffmann @ 2014-06-19 13:46 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Huangweidong (C), Luonengjun, qemu-devel, Gonglei (Arei),
	stefanha, akong

  Hi,

> Can't tell what Gerd had in mind for hcd hotplug sharing,

something like:

usb_hcd_hotplug(char *hcd)
{
   /*
      here:
      device_add $hcd,id=testhcd
      device_add usb-tablet,bus=testhcd.0
      device_del testhcd
    */
}

uhci_hotplug_test()
{
    usb_hcd_hotplug("piix4-usb-uhci");
}

ohci_hotplug_test()
{
    usb_hcd_hotplug("pci-ohci");
}

[ ... ]

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 13:33           ` Andreas Färber
  2014-06-19 13:46             ` Gerd Hoffmann
@ 2014-06-20  1:48             ` Gonglei (Arei)
  1 sibling, 0 replies; 23+ messages in thread
From: Gonglei (Arei) @ 2014-06-20  1:48 UTC (permalink / raw)
  To: Andreas Färber
  Cc: Huangweidong (C), Luonengjun, qemu-devel, Gerd Hoffmann, stefanha, akong

> -----Original Message-----
> From: Andreas Färber [mailto:afaerber@suse.de]
> Sent: Thursday, June 19, 2014 9:33 PM
> To: Gonglei (Arei)
> Cc: Gerd Hoffmann; qemu-devel@nongnu.org; stefanha@redhat.com;
> eblake@redhat.com; akong@redhat.com; Huangweidong (C); Luonengjun
> Subject: Re: [PATCH 0/5] tests: add usb host adapter qtest cases
> 
> Hi Gonglei,
> 
> Am 19.06.2014 15:19, schrieb Gonglei (Arei):
> >> -----Original Message-----
> >> From: Andreas Färber [mailto:afaerber@suse.de]
> >> Sent: Thursday, June 19, 2014 9:07 PM
> >> To: Gerd Hoffmann
> >> Cc: Gonglei (Arei); qemu-devel@nongnu.org; stefanha@redhat.com;
> >> eblake@redhat.com; akong@redhat.com; Huangweidong (C); Luonengjun
> >> Subject: Re: [PATCH 0/5] tests: add usb host adapter qtest cases
> >>
> >> Am 19.06.2014 14:47, schrieb Gerd Hoffmann:
> >>> Maybe it makes sense to have a usb-hcd-hotplug-test.c file and collect
> >>> hotplug testing for all usb hcds we have there.  For code sharing
> >>> that'll be better for sure as the basic code flow is the same for all
> >>> hcd types.
> >>
> >> Ah yes, seeing that there is a "global" QEMU instance in 4/5, that may
> >> make more sense.
> >>
> > Hi, Gerd and Andreas,
> >
> > Can we reach a consensus on this issue?
> 
> IMO it does not make sense to create a new ehci-hotplug file that will
> only ever contain one test. Collecting all HCD hotplug tests into one
> hcd-hotplug file, as Gerd suggested, would be fine with me. We'll still
> need your hci-{ohci,uhci,xhci} files for functional (PCI/MMIO) tests and
> what I referred to as "cold-plug" or init testing though.
> 
OK, get your means, thanks!

> >> OTOH hot-plug testing is a recurring topic for all PCI devices and won't
> >> work in general (e.g., virtio-blk needs drive),
> > Yep.
> >
> >> but maybe we can factor out some helpers to a .h file.
> >>
> > Such as... ?
> 
> Can't tell what Gerd had in mind for hcd hotplug sharing, but I was
> thinking of some wrappers for the device_add and device_del commands.
> Not sure if that makes sense in practice. Probably best start without
> such a header and later we can see if there is much recurring code to be
> factored out.
> 
OK.

> Regards,
> Andreas
> 
> --
> SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
> GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases
  2014-06-19 13:46             ` Gerd Hoffmann
@ 2014-06-20  1:51               ` Gonglei (Arei)
  0 siblings, 0 replies; 23+ messages in thread
From: Gonglei (Arei) @ 2014-06-20  1:51 UTC (permalink / raw)
  To: Gerd Hoffmann, Andreas Färber
  Cc: Huangweidong (C), Luonengjun, qemu-devel, stefanha, akong

Good morning, 
 Gerd & Andreas

> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Thursday, June 19, 2014 9:47 PM
> To: Andreas Färber
> Cc: Gonglei (Arei); qemu-devel@nongnu.org; stefanha@redhat.com;
> eblake@redhat.com; akong@redhat.com; Huangweidong (C); Luonengjun
> Subject: Re: [PATCH 0/5] tests: add usb host adapter qtest cases
> 
>   Hi,
> 
> > Can't tell what Gerd had in mind for hcd hotplug sharing,
> 
> something like:
> 
> usb_hcd_hotplug(char *hcd)
> {
>    /*
>       here:
>       device_add $hcd,id=testhcd
>       device_add usb-tablet,bus=testhcd.0
>       device_del testhcd
>     */
> }
> 
> uhci_hotplug_test()
> {
>     usb_hcd_hotplug("piix4-usb-uhci");
> }
> 
> ohci_hotplug_test()
> {
>     usb_hcd_hotplug("pci-ohci");
> }
> 
> [ ... ]
> 
> cheers,
>   Gerd
> 
OK, I will post a new version including your all suggestion, thanks!

Best regards,
-Gonglei

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-06-20  1:52 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-17  8:03 [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases arei.gonglei
2014-06-17  8:03 ` [Qemu-devel] [PATCH 1/5] tests: add OHCI qtest arei.gonglei
2014-06-19 12:34   ` Andreas Färber
2014-06-19 12:48     ` Gonglei (Arei)
2014-06-17  8:04 ` [Qemu-devel] [PATCH 2/5] tests: add UHCI qtest arei.gonglei
2014-06-19 12:40   ` Andreas Färber
2014-06-19 12:59     ` Gonglei (Arei)
2014-06-17  8:04 ` [Qemu-devel] [PATCH 3/5] tests: add xHCI qtest arei.gonglei
2014-06-19 12:37   ` Andreas Färber
2014-06-19 12:57     ` Gonglei (Arei)
2014-06-17  8:04 ` [Qemu-devel] [PATCH 4/5] usb-hcd-ehci-test: change ehci qtest more expansively arei.gonglei
2014-06-19 12:55   ` Andreas Färber
2014-06-17  8:04 ` [Qemu-devel] [PATCH 5/5] usb-hcd-ehci-test: add ehci hotplug/unplug qtest arei.gonglei
2014-06-19 10:05 ` [Qemu-devel] [PATCH 0/5] tests: add usb host adapter qtest cases Gerd Hoffmann
2014-06-19 12:18   ` Gonglei (Arei)
2014-06-19 12:24   ` Andreas Färber
2014-06-19 12:47     ` Gerd Hoffmann
2014-06-19 13:07       ` Andreas Färber
2014-06-19 13:19         ` Gonglei (Arei)
2014-06-19 13:33           ` Andreas Färber
2014-06-19 13:46             ` Gerd Hoffmann
2014-06-20  1:51               ` Gonglei (Arei)
2014-06-20  1:48             ` Gonglei (Arei)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.