@@ -207,7 +207,6 @@ gcov-files-pci-y += hw/net/e1000.c
gcov-files-pci-y += hw/net/e1000e.c hw/net/e1000e_core.c
check-qtest-pci-y += tests/rtl8139-test$(EXESUF)
gcov-files-pci-y += hw/net/rtl8139.c
-check-qtest-pci-y += tests/pcnet-test$(EXESUF)
gcov-files-pci-y += hw/net/pcnet.c
gcov-files-pci-y += hw/net/pcnet-pci.c
check-qtest-pci-y += tests/eepro100-test$(EXESUF)
@@ -793,6 +792,7 @@ libqgraph-tests-obj-y += tests/tpci200-test.o
libqgraph-tests-obj-y += tests/ipoctal232-test.o
libqgraph-tests-obj-y += tests/ne2000-test.o
libqgraph-tests-obj-y += tests/nvme-test.o
+libqgraph-tests-obj-y += tests/pcnet-test.o
check-unit-y += tests/test-qgraph$(EXESUF)
tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -828,7 +828,6 @@ tests/q35-test$(EXESUF): tests/q35-test.o $(libqos-pc-obj-y)
tests/fw_cfg-test$(EXESUF): tests/fw_cfg-test.o $(libqos-pc-obj-y)
tests/e1000-test$(EXESUF): tests/e1000-test.o
tests/rtl8139-test$(EXESUF): tests/rtl8139-test.o $(libqos-pc-obj-y)
-tests/pcnet-test$(EXESUF): tests/pcnet-test.o
tests/pnv-xscom-test$(EXESUF): tests/pnv-xscom-test.o
tests/eepro100-test$(EXESUF): tests/eepro100-test.o
tests/vmxnet3-test$(EXESUF): tests/vmxnet3-test.o
@@ -9,23 +9,44 @@
#include "qemu/osdep.h"
#include "libqtest.h"
+#include "libqos/qgraph.h"
+
+typedef struct QPcnet QPcnet;
+
+struct QPcnet {
+ QOSGraphObject obj;
+};
/* Tests only initialization so far. TODO: Replace with functional tests */
-static void pci_nop(void)
+static void pci_nop(void *obj, void *data, QGuestAllocator *alloc)
+{
+}
+
+static void pcnet_destructor(QOSGraphObject *obj)
{
+ QPcnet *pcnet = (QPcnet *)obj;
+ g_free(pcnet);
}
-int main(int argc, char **argv)
+static void *pcnet_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
{
- int ret;
+ QPcnet *pcnet = g_new0(QPcnet, 1);
+ pcnet->obj.destructor = pcnet_destructor;
- g_test_init(&argc, &argv, NULL);
- qtest_add_func("/pcnet/pci/nop", pci_nop);
+ return &pcnet->obj;
+}
- qtest_start("-device pcnet");
- ret = g_test_run();
+static void pcnet_register_nodes(void)
+{
+ qos_node_create_driver("pcnet", pcnet_create);
+ qos_node_consumes("pcnet", "pci-bus", NULL);
+}
- qtest_end();
+libqos_init(pcnet_register_nodes);
- return ret;
+static void register_pcnet_test(void)
+{
+ qos_add_test("pcnet-test", "pcnet", pci_nop, NULL);
}
+
+libqos_init(register_pcnet_test);
Convert tests/pcnet-test in qgraph test node, pcnet-test. Since it's a nop test, node creation and initialization is made in the same file. Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com> --- tests/Makefile.include | 3 +-- tests/pcnet-test.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-)