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>
This commit is contained in:
Igor Mammedov 2014-09-26 09:28:13 +00:00 committed by Andreas Färber
parent b0354ec596
commit fbd942c993
2 changed files with 17 additions and 3 deletions

View File

@ -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)

View File

@ -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;
}