[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 08/16] test/qgraph: ne2k_pci test node
From: |
Emanuele Giuseppe Esposito |
Subject: |
[Qemu-block] [PATCH 08/16] test/qgraph: ne2k_pci test node |
Date: |
Mon, 20 Aug 2018 14:02:05 +0200 |
Convert tests/ne2000-test in qgraph test node,
ne2000-test. Since it's a nop test, node creation and
initialization is made in the same file.
The actual device consumed by the test is ne2k_pci.
Signed-off-by: Emanuele Giuseppe Esposito <address@hidden>
---
tests/Makefile.include | 3 +--
tests/ne2000-test.c | 39 ++++++++++++++++++++++++++++++---------
2 files changed, 31 insertions(+), 11 deletions(-)
diff --git a/tests/Makefile.include b/tests/Makefile.include
index 6a7848bd34..dea79797c5 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -212,7 +212,6 @@ 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)
gcov-files-pci-y += hw/net/eepro100.c
-check-qtest-pci-y += tests/ne2000-test$(EXESUF)
gcov-files-pci-y += hw/net/ne2000.c
check-qtest-pci-y += tests/nvme-test$(EXESUF)
gcov-files-pci-y += hw/block/nvme.c
@@ -793,6 +792,7 @@ libqgraph-tests-obj-y += tests/virtio-scsi-test.o
libqgraph-tests-obj-y += tests/ac97-test.o
libqgraph-tests-obj-y += tests/tpci200-test.o
libqgraph-tests-obj-y += tests/ipoctal232-test.o
+libqgraph-tests-obj-y += tests/ne2000-test.o
check-unit-y += tests/test-qgraph$(EXESUF)
tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -832,7 +832,6 @@ 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
-tests/ne2000-test$(EXESUF): tests/ne2000-test.o
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
diff --git a/tests/ne2000-test.c b/tests/ne2000-test.c
index b7cf3dd2f5..aeb2232e2a 100644
--- a/tests/ne2000-test.c
+++ b/tests/ne2000-test.c
@@ -9,23 +9,44 @@
#include "qemu/osdep.h"
#include "libqtest.h"
+#include "libqos/qgraph.h"
+
+typedef struct QNe2k_pci QNe2k_pci;
+
+struct QNe2k_pci {
+ 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 ne2k_pci_destructor(QOSGraphObject *obj)
{
+ QNe2k_pci *ne2k_pci = (QNe2k_pci *)obj;
+ g_free(ne2k_pci);
}
-int main(int argc, char **argv)
+static void *ne2k_pci_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
{
- int ret;
+ QNe2k_pci *ne2k_pci = g_new0(QNe2k_pci, 1);
+ ne2k_pci->obj.destructor = ne2k_pci_destructor;
- g_test_init(&argc, &argv, NULL);
- qtest_add_func("/ne2000/pci/nop", pci_nop);
+ return &ne2k_pci->obj;
+}
- qtest_start("-device ne2k_pci");
- ret = g_test_run();
+static void ne2000_register_nodes(void)
+{
+ qos_node_create_driver("ne2k_pci", ne2k_pci_create);
+ qos_node_consumes("ne2k_pci", "pci-bus", NULL);
+}
- qtest_end();
+libqos_init(ne2000_register_nodes);
- return ret;
+static void register_ne2000_test(void)
+{
+ qos_add_test("ne2000-test", "ne2k_pci", pci_nop, NULL);
}
+
+libqos_init(register_ne2000_test);
\ No newline at end of file
--
2.17.1
- [Qemu-block] [PATCH 01/16] test/qgraph: arm/smdkc210 machine node, (continued)
- [Qemu-block] [PATCH 01/16] test/qgraph: arm/smdkc210 machine node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 02/16] test/qgraph: arm/sabrelite machine node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 06/16] test/qgraph: tpci200 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 04/16] test/qgraph: aarch64/xlnx-zcu102 machine node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 07/16] test/qgraph: ipoctal232 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 05/16] test/qgraph: ac97 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 03/16] test/qgraph: arm/xlinx-zynq-a9 machine node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 12/16] test/qgraph: usb-hcd-ohci test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 11/16] test/qgraph: spapr-phb test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 10/16] test/qgraph: pcnet test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 08/16] test/qgraph: ne2k_pci test node,
Emanuele Giuseppe Esposito <=
- [Qemu-block] [PATCH 09/16] test/qgraph: nvme test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 13/16] test/qgraph: vmxnet3 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 14/16] test/qgraph: es1370 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 15/16] test/qgraph: eepro100 test node, Emanuele Giuseppe Esposito, 2018/08/20
- [Qemu-block] [PATCH 16/16] test/qgraph: e1000 test node, Emanuele Giuseppe Esposito, 2018/08/20