@@ -214,7 +214,6 @@ gcov-files-pci-y += hw/net/eepro100.c
gcov-files-pci-y += hw/net/ne2000.c
gcov-files-pci-y += hw/block/nvme.c
gcov-files-pci-y += hw/audio/ac97.c
-check-qtest-pci-y += tests/es1370-test$(EXESUF)
gcov-files-pci-y += hw/audio/es1370.c
check-qtest-pci-y += $(check-qtest-virtio-y)
gcov-files-pci-y += $(gcov-files-virtio-y) hw/virtio/virtio-pci.c
@@ -792,6 +791,7 @@ libqgraph-tests-obj-y += tests/pcnet-test.o
libqgraph-tests-obj-y += tests/spapr-phb-test.o
libqgraph-tests-obj-y += tests/usb-hcd-ohci-test.o $(libqos-usb-obj-y)
libqgraph-tests-obj-y += tests/vmxnet3-test.o
+libqgraph-tests-obj-y += tests/es1370-test.o
check-unit-y += tests/test-qgraph$(EXESUF)
tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -839,7 +839,6 @@ tests/drive_del-test$(EXESUF): tests/drive_del-test.o $(libqos-virtio-obj-y)
tests/qdev-monitor-test$(EXESUF): tests/qdev-monitor-test.o $(libqos-pc-obj-y)
tests/pvpanic-test$(EXESUF): tests/pvpanic-test.o
tests/i82801b11-test$(EXESUF): tests/i82801b11-test.o
-tests/es1370-test$(EXESUF): tests/es1370-test.o
tests/intel-hda-test$(EXESUF): tests/intel-hda-test.o
tests/ioh3420-test$(EXESUF): tests/ioh3420-test.o
tests/usb-hcd-uhci-test$(EXESUF): tests/usb-hcd-uhci-test.o $(libqos-usb-obj-y)
@@ -9,23 +9,44 @@
#include "qemu/osdep.h"
#include "libqtest.h"
+#include "libqos/qgraph.h"
+
+typedef struct QES1370 QES1370;
+
+struct QES1370 {
+ 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)
+{
+}
+
+static void es1370_destructor(QOSGraphObject *obj)
{
+ QES1370 *es1370 = (QES1370 *)obj;
+ g_free(es1370);
}
-int main(int argc, char **argv)
+static void *es1370_create(void *pci_bus, QGuestAllocator *alloc, void *addr)
{
- int ret;
+ QES1370 *es1370 = g_new0(QES1370, 1);
+ es1370->obj.destructor = es1370_destructor;
- g_test_init(&argc, &argv, NULL);
- qtest_add_func("/es1370/nop", nop);
+ return &es1370->obj;
+}
- qtest_start("-device ES1370");
- ret = g_test_run();
+static void es1370_register_nodes(void)
+{
+ qos_node_create_driver("ES1370", es1370_create);
+ qos_node_consumes("ES1370", "pci-bus", NULL);
+}
- qtest_end();
+libqos_init(es1370_register_nodes);
- return ret;
+static void register_es1370_test(void)
+{
+ qos_add_test("es1370-test", "ES1370", nop, NULL);
}
+
+libqos_init(register_es1370_test);
Convert tests/es1370-test in qgraph test node, es1370-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/es1370-test.c | 39 ++++++++++++++++++++++++++++++--------- 2 files changed, 31 insertions(+), 11 deletions(-)