diff options
author | Igor Mammedov <imammedo@redhat.com> | 2014-09-26 09:28:13 +0000 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2014-10-15 05:03:12 +0200 |
commit | fbd942c993001f5276fcd1f25a56405fdd968472 (patch) | |
tree | 21f6113cd965e3b0af98a7b9375410e0bf26bda3 /tests | |
parent | b0354ec59640a23c3be544d904400e38be8ff51d (diff) |
tests: usb: add port test to uhci unit test
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile | 2 | ||||
-rw-r--r-- | tests/usb-hcd-uhci-test.c | 18 |
2 files changed, 17 insertions, 3 deletions
diff --git a/tests/Makefile b/tests/Makefile index d2294abf74..6d143880e1 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -345,7 +345,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-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y) tests/usb-hcd-ehci-test$(EXESUF): tests/usb-hcd-ehci-test.o $(libqos-usb-obj-y) tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o tests/vhost-user-test$(EXESUF): tests/vhost-user-test.o qemu-char.o qemu-timer.o $(qtest-obj-y) diff --git a/tests/usb-hcd-uhci-test.c b/tests/usb-hcd-uhci-test.c index 94e858f4c6..68047b8006 100644 --- a/tests/usb-hcd-uhci-test.c +++ b/tests/usb-hcd-uhci-test.c @@ -11,13 +11,23 @@ #include <string.h> #include "libqtest.h" #include "qemu/osdep.h" +#include "libqos/usb.h" +#include "hw/usb/uhci-regs.h" static void test_uhci_init(void) { - qtest_start("-device piix3-usb-uhci,id=uhci"); +} - qtest_end(); +static void test_port_1(void) +{ + QPCIBus *pcibus; + struct qhc uhci; + + pcibus = qpci_init_pc(); + g_assert(pcibus != NULL); + qusb_pci_init_one(pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4); + uhci_port_test(&uhci, 0, UHCI_PORT_CCS); } @@ -28,8 +38,12 @@ int main(int argc, char **argv) g_test_init(&argc, &argv, NULL); qtest_add_func("/uhci/pci/init", test_uhci_init); + qtest_add_func("/uhci/pci/port1", test_port_1); + qtest_start("-device piix3-usb-uhci,id=uhci,addr=1d.0" + " -device usb-tablet,bus=uhci.0,port=1"); ret = g_test_run(); + qtest_end(); return ret; } |