qos-test: usb-hcd-ohci test node
Convert tests/usb-hcd-ohci-test to a driver node; currently it runs the PCI nop test only, therefore we're not placing it in tests/libqos. Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
dca063065a
commit
fb7e0b48bd
|
@ -184,7 +184,6 @@ check-qtest-i386-$(CONFIG_VMXNET3_PCI) += tests/vmxnet3-test$(EXESUF)
|
||||||
check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)
|
check-qtest-i386-$(CONFIG_PVPANIC) += tests/pvpanic-test$(EXESUF)
|
||||||
check-qtest-i386-$(CONFIG_I82801B11) += tests/i82801b11-test$(EXESUF)
|
check-qtest-i386-$(CONFIG_I82801B11) += tests/i82801b11-test$(EXESUF)
|
||||||
check-qtest-i386-$(CONFIG_IOH3420) += tests/ioh3420-test$(EXESUF)
|
check-qtest-i386-$(CONFIG_IOH3420) += tests/ioh3420-test$(EXESUF)
|
||||||
check-qtest-i386-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
|
|
||||||
check-qtest-i386-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
|
check-qtest-i386-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
|
||||||
ifeq ($(CONFIG_USB_ECHI)$(CONFIG_USB_UHCI),yy)
|
ifeq ($(CONFIG_USB_ECHI)$(CONFIG_USB_UHCI),yy)
|
||||||
check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
|
check-qtest-i386-y += tests/usb-hcd-ehci-test$(EXESUF)
|
||||||
|
@ -241,7 +240,6 @@ check-qtest-ppc64-y += tests/migration-test$(EXESUF)
|
||||||
check-qtest-ppc64-y += tests/test-announce-self$(EXESUF)
|
check-qtest-ppc64-y += tests/test-announce-self$(EXESUF)
|
||||||
check-qtest-ppc64-$(CONFIG_PSERIES) += tests/rtas-test$(EXESUF)
|
check-qtest-ppc64-$(CONFIG_PSERIES) += tests/rtas-test$(EXESUF)
|
||||||
check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
check-qtest-ppc64-$(CONFIG_SLIRP) += tests/pxe-test$(EXESUF)
|
||||||
check-qtest-ppc64-$(CONFIG_USB_OHCI) += tests/usb-hcd-ohci-test$(EXESUF)
|
|
||||||
check-qtest-ppc64-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
|
check-qtest-ppc64-$(CONFIG_USB_UHCI) += tests/usb-hcd-uhci-test$(EXESUF)
|
||||||
check-qtest-ppc64-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
|
check-qtest-ppc64-$(CONFIG_USB_XHCI_NEC) += tests/usb-hcd-xhci-test$(EXESUF)
|
||||||
check-qtest-ppc64-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
check-qtest-ppc64-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
|
||||||
|
@ -755,6 +753,7 @@ qos-test-obj-y += tests/pci-test.o
|
||||||
qos-test-obj-y += tests/pcnet-test.o
|
qos-test-obj-y += tests/pcnet-test.o
|
||||||
qos-test-obj-y += tests/sdhci-test.o
|
qos-test-obj-y += tests/sdhci-test.o
|
||||||
qos-test-obj-y += tests/spapr-phb-test.o
|
qos-test-obj-y += tests/spapr-phb-test.o
|
||||||
|
qos-test-obj-y += tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y)
|
||||||
qos-test-obj-$(CONFIG_VHOST_NET_USER) += tests/vhost-user-test.o $(chardev-obj-y) $(test-io-obj-y)
|
qos-test-obj-$(CONFIG_VHOST_NET_USER) += tests/vhost-user-test.o $(chardev-obj-y) $(test-io-obj-y)
|
||||||
qos-test-obj-y += tests/virtio-test.o
|
qos-test-obj-y += tests/virtio-test.o
|
||||||
qos-test-obj-$(CONFIG_VIRTFS) += tests/virtio-9p-test.o
|
qos-test-obj-$(CONFIG_VIRTFS) += tests/virtio-9p-test.o
|
||||||
|
@ -817,7 +816,6 @@ tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
|
||||||
tests/es1370-test$(EXESUF): tests/es1370-test.o
|
tests/es1370-test$(EXESUF): tests/es1370-test.o
|
||||||
tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
|
tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
|
||||||
tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
|
tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
|
||||||
tests/usb-hcd-ohci-test$(EXESUF): tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y)
|
|
||||||
tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y)
|
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-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 $(libqos-usb-obj-y)
|
tests/usb-hcd-xhci-test$(EXESUF): tests/usb-hcd-xhci-test.o $(libqos-usb-obj-y)
|
||||||
|
|
|
@ -10,30 +10,58 @@
|
||||||
#include "qemu/osdep.h"
|
#include "qemu/osdep.h"
|
||||||
#include "libqtest.h"
|
#include "libqtest.h"
|
||||||
#include "libqos/usb.h"
|
#include "libqos/usb.h"
|
||||||
|
#include "libqos/qgraph.h"
|
||||||
|
#include "libqos/pci.h"
|
||||||
|
|
||||||
|
typedef struct QOHCI_PCI QOHCI_PCI;
|
||||||
|
|
||||||
static void test_ohci_init(void)
|
struct QOHCI_PCI {
|
||||||
{
|
QOSGraphObject obj;
|
||||||
|
QPCIDevice dev;
|
||||||
|
};
|
||||||
|
|
||||||
}
|
static void test_ohci_hotplug(void *obj, void *data, QGuestAllocator *alloc)
|
||||||
|
|
||||||
static void test_ohci_hotplug(void)
|
|
||||||
{
|
{
|
||||||
usb_test_hotplug("ohci", "1", NULL);
|
usb_test_hotplug("ohci", "1", NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
static void *ohci_pci_get_driver(void *obj, const char *interface)
|
||||||
{
|
{
|
||||||
int ret;
|
QOHCI_PCI *ohci_pci = obj;
|
||||||
|
|
||||||
g_test_init(&argc, &argv, NULL);
|
if (!g_strcmp0(interface, "pci-device")) {
|
||||||
|
return &ohci_pci->dev;
|
||||||
|
}
|
||||||
|
|
||||||
qtest_add_func("/ohci/pci/init", test_ohci_init);
|
fprintf(stderr, "%s not present in pci-ohci\n", interface);
|
||||||
qtest_add_func("/ohci/pci/hotplug", test_ohci_hotplug);
|
g_assert_not_reached();
|
||||||
|
|
||||||
qtest_start("-device pci-ohci,id=ohci");
|
|
||||||
ret = g_test_run();
|
|
||||||
qtest_end();
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void *ohci_pci_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
|
||||||
|
{
|
||||||
|
QOHCI_PCI *ohci_pci = g_new0(QOHCI_PCI, 1);
|
||||||
|
ohci_pci->obj.get_driver = ohci_pci_get_driver;
|
||||||
|
|
||||||
|
return &ohci_pci->obj;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ohci_pci_register_nodes(void)
|
||||||
|
{
|
||||||
|
QOSGraphEdgeOptions opts = {
|
||||||
|
.extra_device_opts = "addr=04.0,id=ohci",
|
||||||
|
};
|
||||||
|
add_qpci_address(&opts, &(QPCIAddress) { .devfn = QPCI_DEVFN(4, 0) });
|
||||||
|
|
||||||
|
qos_node_create_driver("pci-ohci", ohci_pci_create);
|
||||||
|
qos_node_consumes("pci-ohci", "pci-bus", &opts);
|
||||||
|
qos_node_produces("pci-ohci", "pci-device");
|
||||||
|
}
|
||||||
|
|
||||||
|
libqos_init(ohci_pci_register_nodes);
|
||||||
|
|
||||||
|
static void register_ohci_pci_test(void)
|
||||||
|
{
|
||||||
|
qos_add_test("ohci_pci-test-hotplug", "pci-ohci", test_ohci_hotplug, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
libqos_init(register_ohci_pci_test);
|
||||||
|
|
Loading…
Reference in a new issue