qos-test: ipoctal232 test node

Convert tests/ipoctal232-test to a driver node; currently it runs
the PCI nop test only, therefore we're not placing it in tests/libqos.

This test creates a tpci200 node that produces an interface ipack
consumed by the ipoctal232 device.

Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Emanuele Giuseppe Esposito 2018-08-17 12:48:27 +02:00 committed by Paolo Bonzini
parent 0793a88977
commit 31692b2ec7
2 changed files with 30 additions and 16 deletions

View file

@ -151,8 +151,6 @@ check-qtest-generic-y += tests/qmp-cmd-test$(EXESUF)
check-qtest-generic-y += tests/device-introspect-test$(EXESUF)
check-qtest-generic-y += tests/cdrom-test$(EXESUF)
check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
check-qtest-pci-y += tests/e1000-test$(EXESUF)
check-qtest-pci-$(CONFIG_RTL8139_PCI) += tests/rtl8139-test$(EXESUF)
check-qtest-pci-$(CONFIG_PCNET_PCI) += tests/pcnet-test$(EXESUF)
@ -160,7 +158,6 @@ check-qtest-pci-$(CONFIG_EEPRO100_PCI) += tests/eepro100-test$(EXESUF)
check-qtest-pci-$(CONFIG_NE2000_PCI) += tests/ne2000-test$(EXESUF)
check-qtest-pci-$(CONFIG_NVME_PCI) += tests/nvme-test$(EXESUF)
check-qtest-pci-$(CONFIG_ES1370) += tests/es1370-test$(EXESUF)
check-qtest-pci-$(CONFIG_IPACK) += $(check-qtest-ipack-y)
check-qtest-pci-$(CONFIG_VGA) += tests/display-vga-test$(EXESUF)
check-qtest-pci-$(CONFIG_HDA) += tests/intel-hda-test$(EXESUF)
check-qtest-pci-$(CONFIG_IVSHMEM_DEVICE) += tests/ivshmem-test$(EXESUF)
@ -755,6 +752,7 @@ qos-test-obj-y += tests/libqos/x86_64_pc-machine.o
# Tests
qos-test-obj-y += tests/ac97-test.o
qos-test-obj-y += tests/e1000e-test.o
qos-test-obj-y += tests/ipoctal232-test.o
qos-test-obj-y += tests/pci-test.o
qos-test-obj-y += tests/sdhci-test.o
qos-test-obj-$(CONFIG_VHOST_NET_USER) += tests/vhost-user-test.o $(chardev-obj-y) $(test-io-obj-y)
@ -812,7 +810,6 @@ tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o
tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y)
tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
tests/display-vga-test$(EXESUF): tests/display-vga-test.o
tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
tests/qom-test$(EXESUF): tests/qom-test.o
tests/test-hmp$(EXESUF): tests/test-hmp.o
tests/machine-none-test$(EXESUF): tests/machine-none-test.o

View file

@ -9,23 +9,40 @@
#include "qemu/osdep.h"
#include "libqtest.h"
#include "libqos/qgraph.h"
typedef struct QIpoctal232 QIpoctal232;
struct QIpoctal232 {
QOSGraphObject obj;
};
/* Tests only initialization so far. TODO: Replace with functional tests */
static void nop(void)
static void nop(void *obj, void *data, QGuestAllocator *alloc)
{
}
int main(int argc, char **argv)
static void *ipoctal232_create(void *pci_bus, QGuestAllocator *alloc,
void *addr)
{
int ret;
QIpoctal232 *ipoctal232 = g_new0(QIpoctal232, 1);
g_test_init(&argc, &argv, NULL);
qtest_add_func("/ipoctal232/tpci200/nop", nop);
qtest_start("-device tpci200,id=ipack0 -device ipoctal232,bus=ipack0.0");
ret = g_test_run();
qtest_end();
return ret;
return &ipoctal232->obj;
}
static void ipoctal232_register_nodes(void)
{
qos_node_create_driver("ipoctal232", ipoctal232_create);
qos_node_consumes("ipoctal232", "ipack", &(QOSGraphEdgeOptions) {
.extra_device_opts = "bus=ipack0.0",
});
}
libqos_init(ipoctal232_register_nodes);
static void register_ipoctal232_test(void)
{
qos_add_test("nop", "ipoctal232", nop, NULL);
}
libqos_init(register_ipoctal232_test);