aboutsummaryrefslogtreecommitdiff
path: root/tests/usb-hcd-uhci-test.c
diff options
context:
space:
mode:
authorIgor Mammedov <imammedo@redhat.com>2014-09-26 09:28:13 +0000
committerAndreas Färber <afaerber@suse.de>2014-10-15 05:03:12 +0200
commitfbd942c993001f5276fcd1f25a56405fdd968472 (patch)
tree21f6113cd965e3b0af98a7b9375410e0bf26bda3 /tests/usb-hcd-uhci-test.c
parentb0354ec59640a23c3be544d904400e38be8ff51d (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/usb-hcd-uhci-test.c')
-rw-r--r--tests/usb-hcd-uhci-test.c18
1 files changed, 16 insertions, 2 deletions
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;
}