Skip to content

Commit

Permalink
tests: enable ohci/uhci/xhci tests on PPC64
Browse files Browse the repository at this point in the history
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
  • Loading branch information
vivier authored and dgibson committed Oct 6, 2016
1 parent 61ae5cf commit aa9026f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
8 changes: 7 additions & 1 deletion tests/Makefile.include
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ check-qtest-ppc64-y += tests/postcopy-test$(EXESUF)
check-qtest-ppc64-y += tests/boot-serial-test$(EXESUF)
check-qtest-ppc64-y += tests/rtas-test$(EXESUF)
check-qtest-ppc64-y += tests/pxe-test$(EXESUF)
check-qtest-ppc64-y += tests/usb-hcd-ohci-test$(EXESUF)
gcov-files-ppc64-y += hw/usb/hcd-ohci.c
check-qtest-ppc64-y += tests/usb-hcd-uhci-test$(EXESUF)
gcov-files-ppc64-y += hw/usb/hcd-uhci.c
check-qtest-ppc64-y += tests/usb-hcd-xhci-test$(EXESUF)
gcov-files-ppc64-y += hw/usb/hcd-xhci.c

check-qtest-sh4-y = tests/endianness-test$(EXESUF)

Expand Down Expand Up @@ -597,7 +603,7 @@ libqos-pc-obj-y += tests/libqos/malloc-pc.o tests/libqos/libqos-pc.o
libqos-pc-obj-y += tests/libqos/ahci.o
libqos-omap-obj-y = $(libqos-obj-y) tests/libqos/i2c-omap.o
libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
libqos-usb-obj-y = $(libqos-pc-obj-y) tests/libqos/usb.o
libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o
libqos-virtio-obj-y = $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o

tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o
Expand Down
24 changes: 16 additions & 8 deletions tests/usb-hcd-uhci-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,24 @@

#include "qemu/osdep.h"
#include "libqtest.h"
#include "libqos/libqos.h"
#include "libqos/usb.h"
#include "libqos/libqos-pc.h"
#include "libqos/libqos-spapr.h"
#include "hw/usb/uhci-regs.h"

static QOSState *qs;

static void test_uhci_init(void)
{
}

static void test_port(int port)
{
QPCIBus *pcibus;
struct qhc uhci;

g_assert(port > 0);
pcibus = qpci_init_pc(NULL);
g_assert(pcibus != NULL);
qusb_pci_init_one(pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4);
qusb_pci_init_one(qs->pcibus, &uhci, QPCI_DEVFN(0x1d, 0), 4);
uhci_port_test(&uhci, port - 1, UHCI_PORT_CCS);
}

Expand Down Expand Up @@ -75,6 +76,7 @@ static void test_usb_storage_hotplug(void)

int main(int argc, char **argv)
{
const char *arch = qtest_get_arch();
int ret;

g_test_init(&argc, &argv, NULL);
Expand All @@ -84,11 +86,17 @@ int main(int argc, char **argv)
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,format=raw"
" -device usb-tablet,bus=uhci.0,port=1");
if (strcmp(arch, "i386") == 0 || strcmp(arch, "x86_64") == 0) {
qs = qtest_pc_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
" -drive id=drive0,if=none,file=/dev/null,format=raw"
" -device usb-tablet,bus=uhci.0,port=1");
} else if (strcmp(arch, "ppc64") == 0) {
qs = qtest_spapr_boot("-device piix3-usb-uhci,id=uhci,addr=1d.0"
" -drive id=drive0,if=none,file=/dev/null,format=raw"
" -device usb-tablet,bus=uhci.0,port=1");
}
ret = g_test_run();
qtest_end();
qtest_shutdown(qs);

return ret;
}

0 comments on commit aa9026f

Please sign in to comment.