Skip to contentSkip to conversation

Qtest driver framework

PATCH In review Emanuele Giuseppe Esposito 4 participants 39 messages Aug 13, 2018 – Aug 16, 2018 PowerPC

lore
Share & tools
lore
#0 lore raw

cover Qtest driver framework

Qgraph API for the qtest driver framework

This series of patches introduce a different qtest driver organization, viewing machines, drivers and tests as node in a graph, each having one or multiple edges relations.

The idea is to have a framework where each test asks for a specific driver, and the framework takes care of allocating the proper devices required and passing the correct command line arguments to QEMU.

A node can be of four types:
- MACHINE: for example "arm/raspi2"
- DRIVER: for example "generic-sdhci"
- INTERFACE: for example "sdhci" (interface for all "-sdhci" drivers)
- TEST: for example "sdhci-test", consumes an interface and tests
the functions provided

An edge relation between two nodes (drivers or machines) X and Y can be:
- X CONSUMES Y: Y can be plugged into X
- X PRODUCES Y: X provides the interface Y
- X CONTAINS Y: Y is part of X component

Basic framework steps are the following:
- All nodes and edges are created in their respective machine/driver/test files
- The framework starts QEMU and asks for a list of available devices and machines
- The framework walks the graph starting from the available machines and performs a Depth First Search for tests
- Once a test is found, the path is walked again and all drivers are allocated accordingly and the final interface is passed to the test
- The test is executed
- Unused objects are cleaned and the path discovery is continued

Depending on the QEMU binary used, only some drivers/machines will be available and only test that are reached by them will be executed.

This work is being done as Google Summer of Code 2018 project for QEMU, my mentors are Paolo Bonzini and Laurent Vivier.
Additional infos on the project can be found at:
https://wiki.qemu.org/Features/qtest_driver_framework

v3:
- Minor fixes regarding memory leaks and naming

Emanuele Giuseppe Esposito (32):
tests: qgraph API for the qtest driver framework tests/qgraph: rename qpci_init_pc and qpci_init_spapr functions tests/qgraph: pci-pc driver and interface nodes tests/qgraph: x86_64/pc machine node
tests/qgraph: sdhci driver and interface nodes tests/qgraph: sdhci test node
tests/qgraph: arm/raspi2 machine node
tests/qgraph: pci-spapr driver and interface nodes tests/qgraph: ppc64/pseries machine node tests/qgraph: has_buggy_msi flag
tests/qgraph: e1000e driver and interface nodes tests/qgraph: e1000e-test node
tests/qgraph: virtio_start_device function tests/qgraph: virtio-pci driver and interface nodes tests/qgraph: virtio-mmio driver and interface nodes tests/qgraph: arm/virt machine node
tests/qgraph: virtio-serial driver and interface nodes tests/qgraph: virtio-console test node
tests/qgraph: virtio-serial test node
tests/qgraph: virtio-9p driver and interface nodes tests/qgraph: virtio-9p test node
tests/qgraph: virtio-balloon driver and interface nodes tests/qgraph: virtio-balloon test node
tests/qgraph: virtio-rng driver and interface nodes tests/qgraph: virtio-rng test node
tests/qgraph: virtio-blk driver and interface nodes tests/qgraph: virtio-blk test node
tests/qgraph: virtio-net driver and interface nodes tests/qgraph: virtio-net test node
tests/qgraph: virtio-scsi driver and interface nodes tests/qgraph: virtio-scsi test node
tests/qgraph: temporarly commented vhost-user-test

Paolo Bonzini (1):
tests: virtio: separate ccw tests from libqos

 configure                            |   2 +-
 include/qemu/module.h                |   2 +
 tests/Makefile.include               |  79 +--
 tests/e1000e-test.c                  | 354 +++----------
 tests/i440fx-test.c                  |   2 +-
 tests/ide-test.c                     |   2 +-
 tests/libqos/ahci.c                  |   2 +-
 tests/libqos/e1000e.c                | 262 ++++++++++
 tests/libqos/e1000e.h                |  53 ++
 tests/libqos/libqos-pc.c             |   2 +-
 tests/libqos/libqos-spapr.c          |   2 +-
 tests/libqos/libqos.c                |   2 +-
 tests/libqos/libqos.h                |   2 +-
 tests/libqos/pci-pc.c                |  86 ++--
 tests/libqos/pci-pc.h                |  22 +-
 tests/libqos/pci-spapr.c             | 119 +++--
 tests/libqos/pci-spapr.h             |  26 +-
 tests/libqos/pci.c                   |  37 +-
 tests/libqos/pci.h                   |  15 +
 tests/libqos/ppc64_pseries-machine.c | 111 +++++
 tests/libqos/qgraph.c                | 721 +++++++++++++++++++++++++++
 tests/libqos/qgraph.h                | 515 +++++++++++++++++++
 tests/libqos/qgraph_extra.h          | 263 ++++++++++
 tests/libqos/raspi2-machine.c        |  82 +++
 tests/libqos/sdhci.c                 | 163 ++++++
 tests/libqos/sdhci.h                 |  69 +++
 tests/libqos/virt-machine.c          |  90 ++++
 tests/libqos/virtio-9p.c             | 165 ++++++
 tests/libqos/virtio-9p.h             |  42 ++
 tests/libqos/virtio-balloon.c        | 111 +++++
 tests/libqos/virtio-balloon.h        |  39 ++
 tests/libqos/virtio-blk.c            | 126 +++++
 tests/libqos/virtio-blk.h            |  40 ++
 tests/libqos/virtio-mmio.c           |  66 ++-
 tests/libqos/virtio-mmio.h           |   5 +-
 tests/libqos/virtio-net.c            | 179 +++++++
 tests/libqos/virtio-net.h            |  41 ++
 tests/libqos/virtio-pci.c            |  80 ++-
 tests/libqos/virtio-pci.h            |  12 +
 tests/libqos/virtio-rng.c            | 108 ++++
 tests/libqos/virtio-rng.h            |  39 ++
 tests/libqos/virtio-scsi.c           | 117 +++++
 tests/libqos/virtio-scsi.h           |  39 ++
 tests/libqos/virtio-serial.c         | 109 ++++
 tests/libqos/virtio-serial.h         |  39 ++
 tests/libqos/virtio.c                |   8 +
 tests/libqos/virtio.h                |   1 +
 tests/libqos/x86_64_pc-machine.c     | 110 ++++
 tests/libqtest.h                     |   3 +
 tests/q35-test.c                     |   4 +-
 tests/qos-test.c                     | 481 ++++++++++++++++++
 tests/rtl8139-test.c                 |   2 +-
 tests/sdhci-test.c                   | 222 +++------
 tests/tco-test.c                     |   2 +-
 tests/test-qgraph.c                  | 446 +++++++++++++++++
 tests/usb-hcd-ehci-test.c            |   2 +-
 tests/vhost-user-test.c              |   6 +-
 tests/virtio-9p-test.c               | 221 +++-----
 tests/virtio-balloon-test.c          |  22 +-
 tests/virtio-blk-test.c              | 473 +++++++-----------
 tests/virtio-ccw-test.c              | 121 +++++
 tests/virtio-console-test.c          |  30 +-
 tests/virtio-net-test.c              | 163 ++----
 tests/virtio-rng-test.c              |  25 +-
 tests/virtio-scsi-test.c             | 155 +++---
 tests/virtio-serial-test.c           |  27 +-
 66 files changed, 5674 insertions(+), 1292 deletions(-)
 create mode 100644 tests/libqos/e1000e.c
 create mode 100644 tests/libqos/e1000e.h
 create mode 100644 tests/libqos/ppc64_pseries-machine.c
 create mode 100644 tests/libqos/qgraph.c
 create mode 100644 tests/libqos/qgraph.h
 create mode 100644 tests/libqos/qgraph_extra.h
 create mode 100644 tests/libqos/raspi2-machine.c
 create mode 100644 tests/libqos/sdhci.c
 create mode 100644 tests/libqos/sdhci.h
 create mode 100644 tests/libqos/virt-machine.c
 create mode 100644 tests/libqos/virtio-9p.c
 create mode 100644 tests/libqos/virtio-9p.h
 create mode 100644 tests/libqos/virtio-balloon.c
 create mode 100644 tests/libqos/virtio-balloon.h
 create mode 100644 tests/libqos/virtio-blk.c
 create mode 100644 tests/libqos/virtio-blk.h
 create mode 100644 tests/libqos/virtio-net.c
 create mode 100644 tests/libqos/virtio-net.h
 create mode 100644 tests/libqos/virtio-rng.c
 create mode 100644 tests/libqos/virtio-rng.h
 create mode 100644 tests/libqos/virtio-scsi.c
 create mode 100644 tests/libqos/virtio-scsi.h
 create mode 100644 tests/libqos/virtio-serial.c
 create mode 100644 tests/libqos/virtio-serial.h
 create mode 100644 tests/libqos/x86_64_pc-machine.c
 create mode 100644 tests/qos-test.c
 create mode 100644 tests/test-qgraph.c
 create mode 100644 tests/virtio-ccw-test.c
Signature · 1 line
2.17.1
#2 lore raw

PATCH 2/33 tests/qgraph: rename qpci_init_pc and qpci_init_spapr functions

Rename qpci_init_pc in qpci_pc_new and qpci_init_spapr in qpci_spapr_new, since theese function actually allocate a new pci struct and initialize it. Changed QOSOps field name from qpci_init to qpci_new.

---
 tests/e1000e-test.c         | 2 +-
 tests/i440fx-test.c         | 2 +-
 tests/ide-test.c            | 2 +-
 tests/libqos/ahci.c         | 2 +-
 tests/libqos/libqos-pc.c    | 2 +-
 tests/libqos/libqos-spapr.c | 2 +-
 tests/libqos/libqos.c       | 2 +-
 tests/libqos/libqos.h       | 2 +-
 tests/libqos/pci-pc.c       | 2 +-
 tests/libqos/pci-pc.h       | 9 ++++++++-
 tests/libqos/pci-spapr.c    | 2 +-
 tests/libqos/pci-spapr.h    | 2 +-
 tests/q35-test.c            | 4 ++--
 tests/rtl8139-test.c        | 2 +-
 tests/sdhci-test.c          | 2 +-
 tests/tco-test.c            | 2 +-
 tests/usb-hcd-ehci-test.c   | 2 +-
 tests/vhost-user-test.c     | 2 +-
 18 files changed, 26 insertions(+), 19 deletions(-)
tests/e1000e-test.c +1 -1
index 32aa738b72..574801fd38 100644
@@ -395,7 +395,7 @@ static void data_test_init(e1000e_device *d)
     test_alloc = pc_alloc_init(global_qtest);
     g_assert_nonnull(test_alloc);
 
-    test_bus = qpci_init_pc(global_qtest, test_alloc);
+    test_bus = qpci_new_pc(global_qtest, test_alloc);
     g_assert_nonnull(test_bus);
 
     e1000e_device_init(test_bus, d);
tests/i440fx-test.c +1 -1
index 4390e5591e..69205b58a8 100644
@@ -38,7 +38,7 @@ static QPCIBus *test_start_get_bus(const TestData *s)
     cmdline = g_strdup_printf("-smp %d", s->num_cpus);
     qtest_start(cmdline);
     g_free(cmdline);
-    return qpci_init_pc(global_qtest, NULL);
+    return qpci_new_pc(global_qtest, NULL);
 }
 
 static void test_i440fx_defaults(gconstpointer opaque)
tests/ide-test.c +1 -1
index 2384c2c3e2..ab1fac6074 100644
@@ -150,7 +150,7 @@ static QPCIDevice *get_pci_device(QPCIBar *bmdma_bar, QPCIBar *ide_bar)
     uint16_t vendor_id, device_id;
 
     if (!pcibus) {
-        pcibus = qpci_init_pc(global_qtest, NULL);
+        pcibus = qpci_new_pc(global_qtest, NULL);
     }
 
     /* Find PCI device and verify it's the right one */
tests/libqos/ahci.c +1 -1
index 42d3f76933..36814b4a38 100644
@@ -130,7 +130,7 @@ QPCIDevice *get_ahci_device(QTestState *qts, uint32_t *fingerprint)
     uint32_t ahci_fingerprint;
     QPCIBus *pcibus;
 
-    pcibus = qpci_init_pc(qts, NULL);
+    pcibus = qpci_new_pc(qts, NULL);
 
     /* Find the AHCI PCI device and verify it's the right one. */
     ahci = qpci_device_find(pcibus, QPCI_DEVFN(0x1F, 0x02));
tests/libqos/libqos-pc.c +1 -1
index a9c1aceaa7..293f9b6fe6 100644
@@ -6,7 +6,7 @@
 static QOSOps qos_ops = {
     .init_allocator = pc_alloc_init_flags,
     .uninit_allocator = pc_alloc_uninit,
-    .qpci_init = qpci_init_pc,
+    .qpci_new = qpci_new_pc,
     .qpci_free = qpci_free_pc,
     .shutdown = qtest_pc_shutdown,
 };
tests/libqos/libqos-spapr.c +1 -1
index a37791e5d0..64addfe577 100644
@@ -6,7 +6,7 @@
 static QOSOps qos_ops = {
     .init_allocator = spapr_alloc_init_flags,
     .uninit_allocator = spapr_alloc_uninit,
-    .qpci_init = qpci_init_spapr,
+    .qpci_new = qpci_new_spapr,
     .qpci_free = qpci_free_spapr,
     .shutdown = qtest_spapr_shutdown,
 };
tests/libqos/libqos.c +1 -1
index 013ca68581..48b9682d81 100644
@@ -25,7 +25,7 @@ QOSState *qtest_vboot(QOSOps *ops, const char *cmdline_fmt, va_list ap)
     qs->ops = ops;
     if (ops) {
         qs->alloc = ops->init_allocator(qs->qts, ALLOC_NO_FLAGS);
-        qs->pcibus = ops->qpci_init(qs->qts, qs->alloc);
+        qs->pcibus = ops->qpci_new(qs->qts, qs->alloc);
     }
 
     g_free(cmdline);
tests/libqos/libqos.h +1 -1
index 07d4b93d1d..1af6035db4 100644
@@ -10,7 +10,7 @@ typedef struct QOSState QOSState;
 typedef struct QOSOps {
     QGuestAllocator *(*init_allocator)(QTestState *qts, QAllocOpts);
     void (*uninit_allocator)(QGuestAllocator *);
-    QPCIBus *(*qpci_init)(QTestState *qts, QGuestAllocator *alloc);
+    QPCIBus *(*qpci_new)(QTestState *qts, QGuestAllocator *alloc);
     void (*qpci_free)(QPCIBus *bus);
     void (*shutdown)(QOSState *);
 } QOSOps;
tests/libqos/pci-pc.c +1 -1
index a7803308b7..644f45d8b0 100644
@@ -115,7 +115,7 @@ static void qpci_pc_config_writel(QPCIBus *bus, int devfn, uint8_t offset, uint3
     outl(0xcfc, value);
 }
 
-QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc)
+QPCIBus *qpci_new_pc(QTestState *qts, QGuestAllocator *alloc)
 {
     QPCIBusPC *ret = g_new0(QPCIBusPC, 1);
 
tests/libqos/pci-pc.h +8 -1
index 491eeac756..84cc300735 100644
@@ -16,7 +16,14 @@
 #include "libqos/pci.h"
 #include "libqos/malloc.h"
 
-QPCIBus *qpci_init_pc(QTestState *qts, QGuestAllocator *alloc);
+/* qpci_new_pc():
+* this function creates a new QPCIBusPC object,
+ * and properly initialize its fields.
+ *
+ * returns the QPCIBus *bus field of a newly
+ * allocated QPCIBusPC.
+ */
+QPCIBus *qpci_new_pc(QTestState *qts, QGuestAllocator *alloc);
 void     qpci_free_pc(QPCIBus *bus);
 
 #endif
tests/libqos/pci-spapr.c +1 -1
index c0f7e6db9b..f306cb746d 100644
@@ -160,7 +160,7 @@ static void qpci_spapr_config_writel(QPCIBus *bus, int devfn, uint8_t offset,
 #define SPAPR_PCI_MMIO32_WIN_SIZE    0x80000000 /* 2 GiB */
 #define SPAPR_PCI_IO_WIN_SIZE        0x10000
 
-QPCIBus *qpci_init_spapr(QTestState *qts, QGuestAllocator *alloc)
+QPCIBus *qpci_new_spapr(QTestState *qts, QGuestAllocator *alloc)
 {
     QPCIBusSPAPR *ret = g_new0(QPCIBusSPAPR, 1);
 
tests/libqos/pci-spapr.h +1 -1
index 387686dfc8..177e8c002c 100644
@@ -11,7 +11,7 @@
 #include "libqos/malloc.h"
 #include "libqos/pci.h"
 
-QPCIBus *qpci_init_spapr(QTestState *qts, QGuestAllocator *alloc);
+QPCIBus *qpci_new_spapr(QTestState *qts, QGuestAllocator *alloc);
 void     qpci_free_spapr(QPCIBus *bus);
 
 #endif
tests/q35-test.c +2 -2
index 7ea7acc9d8..34b34bc2b9 100644
@@ -87,7 +87,7 @@ static void test_smram_lock(void)
 
     qtest_start("-M q35");
 
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     g_assert(pcibus != NULL);
 
     pcidev = qpci_device_find(pcibus, 0);
@@ -146,7 +146,7 @@ static void test_tseg_size(const void *data)
     g_free(cmdline);
 
     /* locate the DRAM controller */
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     g_assert(pcibus != NULL);
     pcidev = qpci_device_find(pcibus, 0);
     g_assert(pcidev != NULL);
tests/rtl8139-test.c +1 -1
index 68bfc42178..a85c91f197 100644
@@ -35,7 +35,7 @@ static QPCIDevice *get_device(void)
 {
     QPCIDevice *dev;
 
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     qpci_device_foreach(pcibus, 0x10ec, 0x8139, save_fn, &dev);
     g_assert(dev != NULL);
 
tests/sdhci-test.c +1 -1
index 1d825eb010..be3bad6ceb 100644
@@ -187,7 +187,7 @@ static QSDHCI *machine_start(const struct sdhci_t *test)
         global_qtest = qtest_startf("-machine %s -device sdhci-pci",
                                     test->machine);
 
-        s->pci.bus = qpci_init_pc(global_qtest, NULL);
+        s->pci.bus = qpci_new_pc(global_qtest, NULL);
 
         /* Find PCI device and verify it's the right one */
         s->pci.dev = qpci_device_find(s->pci.bus, QPCI_DEVFN(4, 0));
tests/tco-test.c +1 -1
index 9945fb8469..538ebec036 100644
@@ -64,7 +64,7 @@ static void test_init(TestData *d)
     global_qtest = qs;
     qtest_irq_intercept_in(qs, "ioapic");
 
-    d->bus = qpci_init_pc(qs, NULL);
+    d->bus = qpci_new_pc(qs, NULL);
     d->dev = qpci_device_find(d->bus, QPCI_DEVFN(0x1f, 0x00));
     g_assert(d->dev != NULL);
 
tests/usb-hcd-ehci-test.c +1 -1
index 55d4743a2a..98b3038b2c 100644
@@ -52,7 +52,7 @@ static void ehci_port_test(struct qhc *hc, int port, uint32_t expect)
 
 static void test_init(void)
 {
-    pcibus = qpci_init_pc(global_qtest, NULL);
+    pcibus = qpci_new_pc(global_qtest, NULL);
     g_assert(pcibus != NULL);
 
     qusb_pci_init_one(pcibus, &uhci1, QPCI_DEVFN(0x1d, 0), 4);
tests/vhost-user-test.c +1 -1
index fecc832d99..a976808eba 100644
@@ -191,7 +191,7 @@ static void init_virtio_dev(TestServer *s, uint32_t features_mask)
     uint32_t features;
     int i;
 
-    s->bus = qpci_init_pc(global_qtest, NULL);
+    s->bus = qpci_new_pc(global_qtest, NULL);
     g_assert_nonnull(s->bus);
 
     s->dev = qvirtio_pci_device_find(s->bus, VIRTIO_ID_NET);
Signature · 1 line
2.17.1
#3 lore raw

PATCH 3/33 tests/qgraph: pci-pc driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add pci-bus-pc node, move QPCIBusPC struct declaration in its header (since it will be needed by other drivers) and introduce a setter method for drivers that do not need to allocate but have to initialize QPCIBusPC.

---
 tests/Makefile.include |  2 +
 tests/libqos/pci-pc.c  | 83 +++++++++++++++++++++++++++---------------
 tests/libqos/pci-pc.h  | 17 ++++++++-
 tests/libqos/pci.c     | 32 +++++++++++++++-
 tests/libqos/pci.h     | 12 ++++++
 5 files changed, 112 insertions(+), 34 deletions(-)
tests/Makefile.include +2 -0
index d3ac711db2..d99a58894b 100644
@@ -771,6 +771,8 @@ libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
 libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o
 libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
 
+libqgraph-pci-obj-y = $(libqos-pc-obj-y)
+
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
 
tests/libqos/pci-pc.c +53 -30

115 lines not on this page · raw message

tests/libqos/pci-pc.h +15 -2
index 84cc300735..7b0751d1ef 100644
@@ -15,9 +15,22 @@
 
 #include "libqos/pci.h"
 #include "libqos/malloc.h"
+#include "libqos/qgraph.h"
 
-/* qpci_new_pc():
-* this function creates a new QPCIBusPC object,
+typedef struct QPCIBusPC {
+    QOSGraphObject obj;
+    QPCIBus bus;
+} QPCIBusPC;
+
+/* qpci_init_pc():
+ * this function initialize an already allocated
+ * QPCIBusPC object.
+ *
+ * @ret must be a valid QPCIBusPC * pointer.
+ */
+void qpci_init_pc(QPCIBusPC *ret, QTestState *qts, QGuestAllocator *alloc);
+/* qpci_pc_new():
+ * this function creates a new QPCIBusPC object,
  * and properly initialize its fields.
  *
  * returns the QPCIBus *bus field of a newly
tests/libqos/pci.c +30 -2
index 0b73cb23d0..080e87533e 100644
@@ -15,6 +15,7 @@
 
 #include "hw/pci/pci_regs.h"
 #include "qemu/host-utils.h"
+#include "libqos/qgraph.h"
 
 void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,
                          void (*func)(QPCIDevice *dev, int devfn, void *data),
@@ -50,13 +51,20 @@ void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,
     }
 }
 
+static void qpci_device_set(QPCIDevice *dev, QPCIBus *bus, int devfn)
+{
+    g_assert(dev);
+
+    dev->bus = bus;
+    dev->devfn = devfn;
+}
+
 QPCIDevice *qpci_device_find(QPCIBus *bus, int devfn)
 {
     QPCIDevice *dev;
 
     dev = g_malloc0(sizeof(*dev));
-    dev->bus = bus;
-    dev->devfn = devfn;
+    qpci_device_set(dev, bus, devfn);
 
     if (qpci_config_readw(dev, PCI_VENDOR_ID) == 0xFFFF) {
         g_free(dev);
@@ -66,6 +74,17 @@ QPCIDevice *qpci_device_find(QPCIBus *bus, int devfn)
     return dev;
 }
 
+void qpci_device_init(QPCIDevice *dev, QPCIBus *bus, QPCIAddress *addr)
+{
+    uint16_t vendor_id, device_id;
+
+    qpci_device_set(dev, bus, addr->devfn);
+    vendor_id = qpci_config_readw(dev, PCI_VENDOR_ID);
+    device_id = qpci_config_readw(dev, PCI_DEVICE_ID);
+    g_assert(vendor_id == addr->vendor_id);
+    g_assert(device_id == addr->device_id);
+}
+
 void qpci_device_enable(QPCIDevice *dev)
 {
     uint16_t cmd;
@@ -402,3 +421,12 @@ void qpci_plug_device_test(const char *driver, const char *id,
     qtest_qmp_device_add(driver, id, "'addr': '%d'%s%s", slot,
                          opts ? ", " : "", opts ? opts : "");
 }
+
+void add_qpci_address(QOSGraphEdgeOptions *opts, QPCIAddress *addr)
+{
+    g_assert(addr);
+    g_assert(opts);
+
+    opts->arg = addr;
+    opts->size_arg = sizeof(QPCIAddress);
+}
tests/libqos/pci.h +12 -0
index 429c382282..bcfa6d85a4 100644
@@ -14,6 +14,7 @@
 #define LIBQOS_PCI_H
 
 #include "libqtest.h"
+#include "libqos/qgraph.h"
 
 #define QPCI_PIO_LIMIT    0x10000
 
@@ -22,6 +23,7 @@
 typedef struct QPCIDevice QPCIDevice;
 typedef struct QPCIBus QPCIBus;
 typedef struct QPCIBar QPCIBar;
+typedef struct QPCIAddress QPCIAddress;
 
 struct QPCIBus {
     uint8_t (*pio_readb)(QPCIBus *bus, uint32_t addr);
@@ -51,6 +53,7 @@ struct QPCIBus {
     QTestState *qts;
     uint16_t pio_alloc_ptr;
     uint64_t mmio_alloc_ptr, mmio_limit;
+
 };
 
 struct QPCIBar {
@@ -66,10 +69,17 @@ struct QPCIDevice
     uint64_t msix_table_off, msix_pba_off;
 };
 
+struct QPCIAddress {
+    uint32_t devfn;
+    uint16_t vendor_id;
+    uint16_t device_id;
+};
+
 void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,
                          void (*func)(QPCIDevice *dev, int devfn, void *data),
                          void *data);
 QPCIDevice *qpci_device_find(QPCIBus *bus, int devfn);
+void qpci_device_init(QPCIDevice *dev, QPCIBus *bus, QPCIAddress *addr);
 
 void qpci_device_enable(QPCIDevice *dev);
 uint8_t qpci_find_capability(QPCIDevice *dev, uint8_t id);
@@ -112,4 +122,6 @@ QPCIBar qpci_legacy_iomap(QPCIDevice *dev, uint16_t addr);
 void qpci_plug_device_test(const char *driver, const char *id,
                            uint8_t slot, const char *opts);
 void qpci_unplug_acpi_device_test(const char *id, uint8_t slot);
+
+void add_qpci_address(QOSGraphEdgeOptions *opts, QPCIAddress *addr);
 #endif
Signature · 1 line
2.17.1
#4 lore raw

PATCH 4/33 tests/qgraph: x86_64/pc machine node

In reply to Emanuele Giuseppe Esposito

Add pc machine for the x86_64 QEMU binary. This machine contains an i440FX-pcihost driver, that contains itself a pci-bus-pc that produces the pci-bus interface.

---
 tests/Makefile.include           |   3 +
 tests/libqos/x86_64_pc-machine.c | 110 +++++++++++++++++++++++++++++++
 2 files changed, 113 insertions(+)
 create mode 100644 tests/libqos/x86_64_pc-machine.c
tests/Makefile.include +3 -0
index d99a58894b..2154e53944 100644
@@ -771,7 +771,10 @@ libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
 libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o
 libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
 
+libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o
+
 libqgraph-pci-obj-y = $(libqos-pc-obj-y)
+libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
tests/libqos/x86_64_pc-machine.c new file +110 -0

110 lines not on this page · raw message

Signature · 1 line
2.17.1
#5 lore raw

PATCH 5/33 tests/qgraph: sdhci driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for sdhci-pci and generic-sdhci (memory mapped) drivers. Both drivers implement (produce) the same interface sdhci, that provides the readw - readq - writeq functions.

---
 tests/Makefile.include |   1 +
 tests/libqos/sdhci.c   | 163 +++++++++++++++++++++++++++++++++++++++++
 tests/libqos/sdhci.h   |  69 +++++++++++++++++
 3 files changed, 233 insertions(+)
 create mode 100644 tests/libqos/sdhci.c
 create mode 100644 tests/libqos/sdhci.h
tests/Makefile.include +1 -0
index 2154e53944..90a74854b8 100644
@@ -775,6 +775,7 @@ libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o
 
 libqgraph-pci-obj-y = $(libqos-pc-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
+libqgraph-pci-obj-y += tests/libqos/sdhci.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
tests/libqos/sdhci.c new file +163 -0

163 lines not on this page · raw message

tests/libqos/sdhci.h new file +69 -0

69 lines not on this page · raw message

Signature · 1 line
2.17.1
#6 lore raw

PATCH 6/33 tests/qgraph: sdhci test node

In reply to Emanuele Giuseppe Esposito

Convert tests/sdhci-test in first qgraph test node, sdhci-test. This test consumes an sdhci interface and checks that its function return the expected values.

Note that this test does not allocate any sdhci structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include |   9 +-
 tests/sdhci-test.c     | 222 ++++++++++++-----------------------------
 2 files changed, 68 insertions(+), 163 deletions(-)
tests/Makefile.include +4 -5
index 90a74854b8..c4c7c8d56a 100644
@@ -311,7 +311,6 @@ check-qtest-i386-y += tests/migration-test$(EXESUF)
 check-qtest-i386-y += tests/test-x86-cpuid-compat$(EXESUF)
 check-qtest-i386-y += tests/numa-test$(EXESUF)
 check-qtest-x86_64-y += $(check-qtest-i386-y)
-check-qtest-x86_64-y += tests/sdhci-test$(EXESUF)
 gcov-files-i386-y += i386-softmmu/hw/timer/mc146818rtc.c
 gcov-files-x86_64-y = $(subst i386-softmmu/,x86_64-softmmu/,$(gcov-files-i386-y))
 
@@ -385,10 +384,8 @@ gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
 check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
 gcov-files-arm-y += hw/timer/arm_mptimer.c
 check-qtest-arm-y += tests/boot-serial-test$(EXESUF)
-check-qtest-arm-y += tests/sdhci-test$(EXESUF)
 
 check-qtest-aarch64-y = tests/numa-test$(EXESUF)
-check-qtest-aarch64-y += tests/sdhci-test$(EXESUF)
 check-qtest-aarch64-y += tests/boot-serial-test$(EXESUF)
 
 check-qtest-microblazeel-y = $(check-qtest-microblaze-y)
@@ -777,11 +774,14 @@ libqgraph-pci-obj-y = $(libqos-pc-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
 libqgraph-pci-obj-y += tests/libqos/sdhci.o
 
+libqgraph-tests-obj-y = $(libqgraph-pci-obj-y)
+libqgraph-tests-obj-y += tests/sdhci-test.o
+
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
 
 check-qtest-generic-y += tests/qos-test$(EXESUF)
-tests/qos-test$(EXESUF): tests/qos-test.o $(libqgraph-obj-y)
+tests/qos-test$(EXESUF): tests/qos-test.o $(libqgraph-tests-obj-y)
 
 tests/qmp-test$(EXESUF): tests/qmp-test.o
 tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o
@@ -867,7 +867,6 @@ tests/test-arm-mptimer$(EXESUF): tests/test-arm-mptimer.o
 tests/test-qapi-util$(EXESUF): tests/test-qapi-util.o $(test-util-obj-y)
 tests/numa-test$(EXESUF): tests/numa-test.o
 tests/vmgenid-test$(EXESUF): tests/vmgenid-test.o tests/boot-sector.o tests/acpi-utils.o
-tests/sdhci-test$(EXESUF): tests/sdhci-test.o $(libqos-pc-obj-y)
 tests/cdrom-test$(EXESUF): tests/cdrom-test.o tests/boot-sector.o $(libqos-obj-y)
 
 tests/migration/stress$(EXESUF): tests/migration/stress.o
tests/sdhci-test.c +64 -158

286 lines not on this page · raw message

Signature · 1 line
2.17.1
#7 lore raw

PATCH 7/33 tests/qgraph: arm/raspi2 machine node

In reply to Emanuele Giuseppe Esposito

Add arm/raspi2 machine to the graph. This machine contains a generic-sdhci, so its constructor must take care of setting it properly when called.

---
 tests/Makefile.include        |  1 +
 tests/libqos/raspi2-machine.c | 82 +++++++++++++++++++++++++++++++++++
 2 files changed, 83 insertions(+)
 create mode 100644 tests/libqos/raspi2-machine.c
tests/Makefile.include +1 -0
index c4c7c8d56a..67dbec0d35 100644
@@ -769,6 +769,7 @@ libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o
 libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
 
 libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o
+libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o
 
 libqgraph-pci-obj-y = $(libqos-pc-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/raspi2-machine.c new file +82 -0

82 lines not on this page · raw message

Signature · 1 line
2.17.1
#8 lore raw

PATCH 8/33 tests/qgraph: pci-spapr driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add pci-bus-spapr node, that produces pci-bus. Move QPCIBusSPAPR struct declaration in its header (since it will be needed by other drivers) and introduce a setter method for drivers that do not need to allocate but have to initialize QPCIBusSPAPR.

---
 tests/Makefile.include   |   2 +-
 tests/libqos/pci-spapr.c | 116 +++++++++++++++++++++------------------
 tests/libqos/pci-spapr.h |  24 ++++++++
 3 files changed, 88 insertions(+), 54 deletions(-)
tests/Makefile.include +1 -1
index 67dbec0d35..5713be3ec4 100644
@@ -771,7 +771,7 @@ libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virt
 libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o
 libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o
 
-libqgraph-pci-obj-y = $(libqos-pc-obj-y)
+libqgraph-pci-obj-y = $(libqos-pc-obj-y) $(libqos-spapr-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
 libqgraph-pci-obj-y += tests/libqos/sdhci.o
 
tests/libqos/pci-spapr.c +63 -53

156 lines not on this page · raw message

tests/libqos/pci-spapr.h +24 -0
index 177e8c002c..d9e25631c6 100644
@@ -10,7 +10,31 @@
 
 #include "libqos/malloc.h"
 #include "libqos/pci.h"
+#include "libqos/qgraph.h"
 
+/* From include/hw/pci-host/spapr.h */
+
+typedef struct QPCIWindow {
+    uint64_t pci_base;    /* window address in PCI space */
+    uint64_t size;        /* window size */
+} QPCIWindow;
+
+typedef struct QPCIBusSPAPR {
+    QOSGraphObject obj;
+    QPCIBus bus;
+    QGuestAllocator *alloc;
+
+    uint64_t buid;
+
+    uint64_t pio_cpu_base;
+    QPCIWindow pio;
+
+    uint64_t mmio32_cpu_base;
+    QPCIWindow mmio32;
+} QPCIBusSPAPR;
+
+void qpci_init_spapr(QPCIBusSPAPR *ret, QTestState *qts,
+                     QGuestAllocator *alloc);
 QPCIBus *qpci_new_spapr(QTestState *qts, QGuestAllocator *alloc);
 void     qpci_free_spapr(QPCIBus *bus);
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/33 tests: qgraph API for the qtest driver framework

In reply to Emanuele Giuseppe Esposito

Add qgraph API that allows to add/remove nodes and edges from the graph, implementation of Depth First Search to discover the paths and basic unit test to check correctness of the API.
Included also a main executable that takes care of starting the framework, create the nodes, set the available drivers/machines, discover the path and run tests.

graph.h provides the public API to manage the graph nodes/edges graph_extra.h provides a more private API used successively by the gtest integration part qos-test.c provides the main executable

---
 configure                   |   2 +-
 include/qemu/module.h       |   2 +
 tests/Makefile.include      |  12 +-
 tests/libqos/qgraph.c       | 721 ++++++++++++++++++++++++++++++++++++
 tests/libqos/qgraph.h       | 515 ++++++++++++++++++++++++++
 tests/libqos/qgraph_extra.h | 263 +++++++++++++
 tests/libqtest.h            |   3 +
 tests/qos-test.c            | 481 ++++++++++++++++++++++++
 tests/test-qgraph.c         | 446 ++++++++++++++++++++++
 9 files changed, 2442 insertions(+), 3 deletions(-)
 create mode 100644 tests/libqos/qgraph.c
 create mode 100644 tests/libqos/qgraph.h
 create mode 100644 tests/libqos/qgraph_extra.h
 create mode 100644 tests/qos-test.c
 create mode 100644 tests/test-qgraph.c
configure +1 -1
index 2a7796ea80..85a108506a 100755
@@ -7352,7 +7352,7 @@ if test "$ccache_cpp2" = "yes"; then
 fi
 
 # build tree in object directory in case the source is not in the current directory
-DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm"
+DIRS="tests tests/tcg tests/tcg/cris tests/tcg/lm32 tests/libqos tests/qapi-schema tests/tcg/xtensa tests/qemu-iotests tests/vm tests/qgraph"
 DIRS="$DIRS docs docs/interop fsdev scsi"
 DIRS="$DIRS pc-bios/optionrom pc-bios/spapr-rtas pc-bios/s390-ccw"
 DIRS="$DIRS roms/seabios roms/vgabios"
include/qemu/module.h +2 -0
index 54300ab6e5..1fcdca084d 100644
@@ -44,6 +44,7 @@ typedef enum {
     MODULE_INIT_OPTS,
     MODULE_INIT_QOM,
     MODULE_INIT_TRACE,
+    MODULE_INIT_LIBQOS,
     MODULE_INIT_MAX
 } module_init_type;
 
@@ -51,6 +52,7 @@ typedef enum {
 #define opts_init(function) module_init(function, MODULE_INIT_OPTS)
 #define type_init(function) module_init(function, MODULE_INIT_QOM)
 #define trace_init(function) module_init(function, MODULE_INIT_TRACE)
+#define libqos_init(function) module_init(function, MODULE_INIT_LIBQOS)
 
 #define block_module_load_one(lib) module_load_one("block-", lib)
 #define ui_module_load_one(lib) module_load_one("ui-", lib)
tests/Makefile.include +10 -2
index a49282704e..d3ac711db2 100644
@@ -755,8 +755,10 @@ tests/test-crypto-ivgen$(EXESUF): tests/test-crypto-ivgen.o $(test-crypto-obj-y)
 tests/test-crypto-afsplit$(EXESUF): tests/test-crypto-afsplit.o $(test-crypto-obj-y)
 tests/test-crypto-block$(EXESUF): tests/test-crypto-block.o $(test-crypto-obj-y)
 
-libqos-obj-y = tests/libqos/pci.o tests/libqos/fw_cfg.o tests/libqos/malloc.o
-libqos-obj-y += tests/libqos/i2c.o tests/libqos/libqos.o
+libqgraph-obj-y = tests/libqos/qgraph.o
+
+libqos-obj-y = $(libqgraph-obj-y) tests/libqos/pci.o tests/libqos/fw_cfg.o
+libqos-obj-y += tests/libqos/malloc.o tests/libqos/i2c.o tests/libqos/libqos.o
 libqos-spapr-obj-y = $(libqos-obj-y) tests/libqos/malloc-spapr.o
 libqos-spapr-obj-y += tests/libqos/libqos-spapr.o
 libqos-spapr-obj-y += tests/libqos/rtas.o
@@ -769,6 +771,12 @@ libqos-imx-obj-y = $(libqos-obj-y) tests/libqos/i2c-imx.o
 libqos-usb-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/usb.o
 libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virtio.o tests/libqos/virtio-pci.o tests/libqos/virtio-mmio.o tests/libqos/malloc-generic.o
 
+check-unit-y += tests/test-qgraph$(EXESUF)
+tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
+
+check-qtest-generic-y += tests/qos-test$(EXESUF)
+tests/qos-test$(EXESUF): tests/qos-test.o $(libqgraph-obj-y)
+
 tests/qmp-test$(EXESUF): tests/qmp-test.o
 tests/device-introspect-test$(EXESUF): tests/device-introspect-test.o
 tests/rtc-test$(EXESUF): tests/rtc-test.o
tests/libqos/qgraph.c new file +721 -0

721 lines not on this page · raw message

tests/libqos/qgraph.h new file +515 -0

515 lines not on this page · raw message

tests/libqos/qgraph_extra.h new file +263 -0

263 lines not on this page · raw message

tests/libqtest.h +3 -0
index ac52872cbe..7a6fa6e1d1 100644
@@ -555,6 +555,9 @@ static inline QTestState *qtest_start(const char *args)
  */
 static inline void qtest_end(void)
 {
+    if (!global_qtest) {
+        return;
+    }
     qtest_quit(global_qtest);
     global_qtest = NULL;
 }
tests/qos-test.c new file +481 -0

481 lines not on this page · raw message

tests/test-qgraph.c new file +446 -0

446 lines not on this page · raw message

Signature · 1 line
2.17.1
#9 lore raw

PATCH 9/33 tests/qgraph: ppc64/pseries machine node

In reply to Emanuele Giuseppe Esposito

Add pseries machine for the ppc64 QEMU binary. This machine contains a spapr-pci-host-bridge driver, that contains itself a pci-bus-spapr that produces the pci-bus interface.

---
 tests/Makefile.include               |   1 +
 tests/libqos/ppc64_pseries-machine.c | 111 +++++++++++++++++++++++++++
 2 files changed, 112 insertions(+)
 create mode 100644 tests/libqos/ppc64_pseries-machine.c
tests/Makefile.include +1 -0
index 5713be3ec4..7c712406e1 100644
@@ -770,6 +770,7 @@ libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virt
 
 libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o
 libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o
+libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o
 
 libqgraph-pci-obj-y = $(libqos-pc-obj-y) $(libqos-spapr-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/ppc64_pseries-machine.c new file +111 -0

111 lines not on this page · raw message

Signature · 1 line
2.17.1
#10 lore raw

PATCH 10/33 tests/qgraph: has_buggy_msi flag

In reply to Emanuele Giuseppe Esposito

The Qgraph framework makes any test using
pci bus run the same function using pci-pci and pci-spapr bus. However, some tests are not ready to use the spapr bus, due to a MSI bug. Until it does not get fixed, this flag allows them to skip the test

---
 tests/libqos/pci-pc.c    | 3 +++
 tests/libqos/pci-spapr.c | 3 +++
 tests/libqos/pci.c       | 5 +++++
 tests/libqos/pci.h       | 3 +++
 4 files changed, 14 insertions(+)
tests/libqos/pci-pc.c +3 -0
index 93cbfbce6b..0cf87f51b5 100644
@@ -123,6 +123,9 @@ void qpci_init_pc(QPCIBusPC *qpci, QTestState *qts, QGuestAllocator *alloc)
 {
     assert(qts);
 
+    /* tests can use pci-bus */
+    qpci->bus.has_buggy_msi = FALSE;
+
     qpci->bus.pio_readb = qpci_pc_pio_readb;
     qpci->bus.pio_readw = qpci_pc_pio_readw;
     qpci->bus.pio_readl = qpci_pc_pio_readl;
tests/libqos/pci-spapr.c +3 -0
index 24f2c2c60d..502a0e5129 100644
@@ -155,6 +155,9 @@ void qpci_init_spapr(QPCIBusSPAPR *qpci, QTestState *qts,
 {
     assert(qts);
 
+    /* tests cannot use spapr, needs to be fixed first */
+    qpci->bus.has_buggy_msi = TRUE;
+
     qpci->alloc = alloc;
 
     qpci->bus.pio_readb = qpci_spapr_pio_readb;
tests/libqos/pci.c +5 -0
index 080e87533e..d5bace9d6a 100644
@@ -51,6 +51,11 @@ void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,
     }
 }
 
+bool qpci_has_buggy_msi(QPCIDevice *dev)
+{
+    return dev->bus->has_buggy_msi;
+}
+
 static void qpci_device_set(QPCIDevice *dev, QPCIBus *bus, int devfn)
 {
     g_assert(dev);
tests/libqos/pci.h +3 -0
index bcfa6d85a4..5fb3c550c5 100644
@@ -53,6 +53,7 @@ struct QPCIBus {
     QTestState *qts;
     uint16_t pio_alloc_ptr;
     uint64_t mmio_alloc_ptr, mmio_limit;
+    bool has_buggy_msi; /* TRUE for spapr, FALSE for pci */
 
 };
 
@@ -80,6 +81,8 @@ void qpci_device_foreach(QPCIBus *bus, int vendor_id, int device_id,
                          void *data);
 QPCIDevice *qpci_device_find(QPCIBus *bus, int devfn);
 void qpci_device_init(QPCIDevice *dev, QPCIBus *bus, QPCIAddress *addr);
+/* returns the bus has_buggy_msi flag */
+bool qpci_has_buggy_msi(QPCIDevice *dev);
 
 void qpci_device_enable(QPCIDevice *dev);
 uint8_t qpci_find_capability(QPCIDevice *dev, uint8_t id);
Signature · 1 line
2.17.1
#11 lore raw

PATCH 11/33 tests/qgraph: e1000e driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-e1000e.
It consumes a pci-bus, and it's directly used by tests (e1000e is pci based).

---
 tests/Makefile.include |   1 +
 tests/libqos/e1000e.c  | 262 +++++++++++++++++++++++++++++++++++++++++
 tests/libqos/e1000e.h  |  53 +++++++++
 3 files changed, 316 insertions(+)
 create mode 100644 tests/libqos/e1000e.c
 create mode 100644 tests/libqos/e1000e.h
tests/Makefile.include +1 -0
index 7c712406e1..9f0d64f4ae 100644
@@ -775,6 +775,7 @@ libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o
 libqgraph-pci-obj-y = $(libqos-pc-obj-y) $(libqos-spapr-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
 libqgraph-pci-obj-y += tests/libqos/sdhci.o
+libqgraph-pci-obj-y += tests/libqos/e1000e.o
 
 libqgraph-tests-obj-y = $(libqgraph-pci-obj-y)
 libqgraph-tests-obj-y += tests/sdhci-test.o
tests/libqos/e1000e.c new file +262 -0

262 lines not on this page · raw message

tests/libqos/e1000e.h new file +53 -0

53 lines not on this page · raw message

Signature · 1 line
2.17.1
#12 lore raw

PATCH 12/33 tests/qgraph: e1000e-test node

In reply to Emanuele Giuseppe Esposito

Convert tests/e1000e-test in qgraph test node, e1000e-test. This test consumes an e1000e interface and checks that its function return the expected values.

Note that this test does not allocate any e1000e structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include |   3 +-
 tests/e1000e-test.c    | 354 +++++++++--------------------------------
 2 files changed, 78 insertions(+), 279 deletions(-)
tests/Makefile.include +1 -2
index 9f0d64f4ae..e18796d8d8 100644
@@ -213,7 +213,6 @@ gcov-files-virtio-y += $(gcov-files-virtioserial-y)
 
 check-qtest-pci-y += tests/e1000-test$(EXESUF)
 gcov-files-pci-y += hw/net/e1000.c
-check-qtest-pci-y += tests/e1000e-test$(EXESUF)
 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
@@ -779,6 +778,7 @@ libqgraph-pci-obj-y += tests/libqos/e1000e.o
 
 libqgraph-tests-obj-y = $(libqgraph-pci-obj-y)
 libqgraph-tests-obj-y += tests/sdhci-test.o
+libqgraph-tests-obj-y += tests/e1000e-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -813,7 +813,6 @@ tests/i440fx-test$(EXESUF): tests/i440fx-test.o $(libqos-pc-obj-y)
 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/e1000e-test$(EXESUF): tests/e1000e-test.o $(libqos-pc-obj-y)
 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/e1000e-test.c +77 -277

422 lines not on this page · raw message

Signature · 1 line
2.17.1
#13 lore raw

PATCH 13/33 tests/qgraph: virtio_start_device function

In reply to Emanuele Giuseppe Esposito

This function is intended to group all the qvirtio_* functions that start the qvirtio devices.
Applied in all tests using this combination of functions.

---
 tests/libqos/virtio.c    |  7 +++++++
 tests/libqos/virtio.h    |  1 +
 tests/vhost-user-test.c  |  4 +---
 tests/virtio-9p-test.c   |  4 +---
 tests/virtio-blk-test.c  | 10 +++-------
 tests/virtio-net-test.c  |  4 +---
 tests/virtio-scsi-test.c |  4 +---
 7 files changed, 15 insertions(+), 19 deletions(-)
tests/libqos/virtio.c +7 -0
index 0dad5c19ac..c1ff0206d5 100644
@@ -365,3 +365,10 @@ const char *qvirtio_get_dev_type(void)
         return "pci";
     }
 }
+
+void qvirtio_start_device(QVirtioDevice *vdev)
+{
+    qvirtio_reset(vdev);
+    qvirtio_set_acknowledge(vdev);
+    qvirtio_set_driver(vdev);
+}
tests/libqos/virtio.h +1 -0
index 69b5b13840..2c68668de0 100644
@@ -146,5 +146,6 @@ bool qvirtqueue_get_buf(QVirtQueue *vq, uint32_t *desc_idx, uint32_t *len);
 void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx);
 
 const char *qvirtio_get_dev_type(void);
+void qvirtio_start_device(QVirtioDevice *vdev);
 
 #endif
tests/vhost-user-test.c +1 -3
index a976808eba..d43d09a013 100644
@@ -198,9 +198,7 @@ static void init_virtio_dev(TestServer *s, uint32_t features_mask)
     g_assert_nonnull(s->dev);
 
     qvirtio_pci_device_enable(s->dev);
-    qvirtio_reset(&s->dev->vdev);
-    qvirtio_set_acknowledge(&s->dev->vdev);
-    qvirtio_set_driver(&s->dev->vdev);
+    qvirtio_start_device(&s->dev->vdev);
 
     s->alloc = pc_alloc_init(global_qtest);
 
tests/virtio-9p-test.c +1 -3
index a2b31085f6..d275c74106 100644
@@ -65,9 +65,7 @@ static QVirtIO9P *qvirtio_9p_pci_start(void)
     v9p->dev = (QVirtioDevice *) dev;
 
     qvirtio_pci_device_enable(dev);
-    qvirtio_reset(v9p->dev);
-    qvirtio_set_acknowledge(v9p->dev);
-    qvirtio_set_driver(v9p->dev);
+    qvirtio_start_device(v9p->dev);
 
     v9p->vq = qvirtqueue_setup(v9p->dev, v9p->qs->alloc, 0);
 
tests/virtio-blk-test.c +3 -7
index 9be9ffb378..66797d0348 100644
@@ -112,10 +112,7 @@ static QVirtioPCIDevice *virtio_blk_pci_init(QPCIBus *bus, int slot)
     g_assert_cmphex(dev->pdev->devfn, ==, ((slot << 3) | PCI_FN));
 
     qvirtio_pci_device_enable(dev);
-    qvirtio_reset(&dev->vdev);
-    qvirtio_set_acknowledge(&dev->vdev);
-    qvirtio_set_driver(&dev->vdev);
-
+    qvirtio_start_device(&dev->vdev);
     return dev;
 }
 
@@ -329,6 +326,7 @@ static void pci_indirect(void)
     qvirtio_set_features(&dev->vdev, features);
 
     vqpci = (QVirtQueuePCI *)qvirtqueue_setup(&dev->vdev, qs->alloc, 0);
+
     qvirtio_set_driver_ok(&dev->vdev);
 
     /* Write request */
@@ -715,9 +713,7 @@ static void mmio_basic(void)
     g_assert(dev != NULL);
     g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK);
 
-    qvirtio_reset(&dev->vdev);
-    qvirtio_set_acknowledge(&dev->vdev);
-    qvirtio_set_driver(&dev->vdev);
+    qvirtio_start_device(&dev->vdev);
 
     alloc = generic_alloc_init(MMIO_RAM_ADDR, MMIO_RAM_SIZE, MMIO_PAGE_SIZE);
     vq = qvirtqueue_setup(&dev->vdev, alloc, 0);
tests/virtio-net-test.c +1 -3
index b285a262e9..72728acf66 100644
@@ -45,9 +45,7 @@ static QVirtioPCIDevice *virtio_net_pci_init(QPCIBus *bus, int slot)
     g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_NET);
 
     qvirtio_pci_device_enable(dev);
-    qvirtio_reset(&dev->vdev);
-    qvirtio_set_acknowledge(&dev->vdev);
-    qvirtio_set_driver(&dev->vdev);
+    qvirtio_start_device(&dev->vdev);
 
     return dev;
 }
tests/virtio-scsi-test.c +1 -3
index 037872bb98..1581b6926c 100644
@@ -159,9 +159,7 @@ static QVirtIOSCSI *qvirtio_scsi_pci_init(int slot)
     g_assert_cmphex(vs->dev->device_type, ==, VIRTIO_ID_SCSI);
 
     qvirtio_pci_device_enable(dev);
-    qvirtio_reset(vs->dev);
-    qvirtio_set_acknowledge(vs->dev);
-    qvirtio_set_driver(vs->dev);
+    qvirtio_start_device(vs->dev);
 
     vs->num_queues = qvirtio_config_readl(vs->dev, 0);
 
Signature · 1 line
2.17.1
#14 lore raw

PATCH 14/33 tests/qgraph: virtio-pci driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add QOSGraphObject to QVirtioPCIDevice structure, with a basic constructor. virtio-pci is not present in qgraph, since it will be used as starting point by its subclasses (virtio-*-pci)

---
 tests/Makefile.include    |  2 +-
 tests/libqos/virtio-pci.c | 80 +++++++++++++++++++++++++++++++--------
 tests/libqos/virtio-pci.h | 12 ++++++
 3 files changed, 77 insertions(+), 17 deletions(-)
tests/Makefile.include +1 -1
index e18796d8d8..5220136473 100644
@@ -771,7 +771,7 @@ libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o
 libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o
 libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o
 
-libqgraph-pci-obj-y = $(libqos-pc-obj-y) $(libqos-spapr-obj-y)
+libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
 libqgraph-pci-obj-y += tests/libqos/sdhci.o
 libqgraph-pci-obj-y += tests/libqos/e1000e.o
tests/libqos/virtio-pci.c +64 -16

190 lines not on this page · raw message

tests/libqos/virtio-pci.h +12 -0
index 6ef19094cb..8b619c5133 100644
@@ -12,8 +12,10 @@
 
 #include "libqos/virtio.h"
 #include "libqos/pci.h"
+#include "libqos/qgraph.h"
 
 typedef struct QVirtioPCIDevice {
+    QOSGraphObject obj;
     QVirtioDevice vdev;
     QPCIDevice *pdev;
     QPCIBar bar;
@@ -31,10 +33,20 @@ typedef struct QVirtQueuePCI {
 
 extern const QVirtioBus qvirtio_pci;
 
+void virtio_pci_init(QVirtioPCIDevice *dev, QPCIBus *bus, QPCIAddress * addr);
 QVirtioPCIDevice *qvirtio_pci_device_find(QPCIBus *bus, uint16_t device_type);
 QVirtioPCIDevice *qvirtio_pci_device_find_slot(QPCIBus *bus,
                                                uint16_t device_type, int slot);
 void qvirtio_pci_device_free(QVirtioPCIDevice *dev);
+/* virtio-pci object functions available for subclasses that
+ * override the original start_hw and destroy
+ * function. All virtio-xxx-pci subclass that override must
+ * take care of calling these two functions in the respective
+ * places
+ */
+void qvirtio_pci_destructor(QOSGraphObject *obj);
+void qvirtio_pci_start_hw(QOSGraphObject *obj);
+
 
 void qvirtio_pci_device_enable(QVirtioPCIDevice *d);
 void qvirtio_pci_device_disable(QVirtioPCIDevice *d);
Signature · 1 line
2.17.1
#15 lore raw

PATCH 15/33 tests/qgraph: virtio-mmio driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add virtio-mmio node in qgraph framework.
virtio-mmio produces virtio, the interface consumed by all virtio-*-device nodes.

Being a memory-mapped device, it doesn't have to provide a constructor to qgraph, since it's always "contained" inside some other nodes.

Also rename qvirtio_mmio_init_device in qvirtio_mmio_device_new, since the function actually allocates a new QVirtioMMIODevice and initialize it.

---
 tests/libqos/virtio-mmio.c | 66 ++++++++++++++++++++++++++------------
 tests/libqos/virtio-mmio.h |  5 ++-
 tests/virtio-blk-test.c    |  3 +-
 3 files changed, 51 insertions(+), 23 deletions(-)
tests/libqos/virtio-mmio.c +45 -21
index 7aa8383338..61ed0e549b 100644
@@ -13,42 +13,43 @@
 #include "libqos/virtio-mmio.h"
 #include "libqos/malloc.h"
 #include "libqos/malloc-generic.h"
+#include "libqos/qgraph.h"
 #include "standard-headers/linux/virtio_ring.h"
 
 static uint8_t qvirtio_mmio_config_readb(QVirtioDevice *d, uint64_t off)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     return readb(dev->addr + QVIRTIO_MMIO_DEVICE_SPECIFIC + off);
 }
 
 static uint16_t qvirtio_mmio_config_readw(QVirtioDevice *d, uint64_t off)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     return readw(dev->addr + QVIRTIO_MMIO_DEVICE_SPECIFIC + off);
 }
 
 static uint32_t qvirtio_mmio_config_readl(QVirtioDevice *d, uint64_t off)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     return readl(dev->addr + QVIRTIO_MMIO_DEVICE_SPECIFIC + off);
 }
 
 static uint64_t qvirtio_mmio_config_readq(QVirtioDevice *d, uint64_t off)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     return readq(dev->addr + QVIRTIO_MMIO_DEVICE_SPECIFIC + off);
 }
 
 static uint32_t qvirtio_mmio_get_features(QVirtioDevice *d)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     writel(dev->addr + QVIRTIO_MMIO_HOST_FEATURES_SEL, 0);
     return readl(dev->addr + QVIRTIO_MMIO_HOST_FEATURES);
 }
 
 static void qvirtio_mmio_set_features(QVirtioDevice *d, uint32_t features)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     dev->features = features;
     writel(dev->addr + QVIRTIO_MMIO_GUEST_FEATURES_SEL, 0);
     writel(dev->addr + QVIRTIO_MMIO_GUEST_FEATURES, features);
@@ -56,25 +57,25 @@ static void qvirtio_mmio_set_features(QVirtioDevice *d, uint32_t features)
 
 static uint32_t qvirtio_mmio_get_guest_features(QVirtioDevice *d)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     return dev->features;
 }
 
 static uint8_t qvirtio_mmio_get_status(QVirtioDevice *d)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     return (uint8_t)readl(dev->addr + QVIRTIO_MMIO_DEVICE_STATUS);
 }
 
 static void qvirtio_mmio_set_status(QVirtioDevice *d, uint8_t status)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     writel(dev->addr + QVIRTIO_MMIO_DEVICE_STATUS, (uint32_t)status);
 }
 
 static bool qvirtio_mmio_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     uint32_t isr;
 
     isr = readl(dev->addr + QVIRTIO_MMIO_INTERRUPT_STATUS) & 1;
@@ -88,7 +89,7 @@ static bool qvirtio_mmio_get_queue_isr_status(QVirtioDevice *d, QVirtQueue *vq)
 
 static bool qvirtio_mmio_get_config_isr_status(QVirtioDevice *d)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     uint32_t isr;
 
     isr = readl(dev->addr + QVIRTIO_MMIO_INTERRUPT_STATUS) & 2;
@@ -102,7 +103,7 @@ static bool qvirtio_mmio_get_config_isr_status(QVirtioDevice *d)
 
 static void qvirtio_mmio_queue_select(QVirtioDevice *d, uint16_t index)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     writel(dev->addr + QVIRTIO_MMIO_QUEUE_SEL, (uint32_t)index);
 
     g_assert_cmphex(readl(dev->addr + QVIRTIO_MMIO_QUEUE_PFN), ==, 0);
@@ -110,20 +111,20 @@ static void qvirtio_mmio_queue_select(QVirtioDevice *d, uint16_t index)
 
 static uint16_t qvirtio_mmio_get_queue_size(QVirtioDevice *d)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     return (uint16_t)readl(dev->addr + QVIRTIO_MMIO_QUEUE_NUM_MAX);
 }
 
 static void qvirtio_mmio_set_queue_address(QVirtioDevice *d, uint32_t pfn)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     writel(dev->addr + QVIRTIO_MMIO_QUEUE_PFN, pfn);
 }
 
 static QVirtQueue *qvirtio_mmio_virtqueue_setup(QVirtioDevice *d,
                                         QGuestAllocator *alloc, uint16_t index)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     QVirtQueue *vq;
     uint64_t addr;
 
@@ -163,7 +164,7 @@ static void qvirtio_mmio_virtqueue_cleanup(QVirtQueue *vq,
 
 static void qvirtio_mmio_virtqueue_kick(QVirtioDevice *d, QVirtQueue *vq)
 {
-    QVirtioMMIODevice *dev = (QVirtioMMIODevice *)d;
+    QVirtioMMIODevice *dev = container_of(d, QVirtioMMIODevice, vdev);
     writel(dev->addr + QVIRTIO_MMIO_QUEUE_NOTIFY, vq->index);
 }
 
@@ -187,12 +188,26 @@ const QVirtioBus qvirtio_mmio = {
     .virtqueue_kick = qvirtio_mmio_virtqueue_kick,
 };
 
-QVirtioMMIODevice *qvirtio_mmio_init_device(uint64_t addr, uint32_t page_size)
+static void *qvirtio_mmio_get_driver(void *obj, const char *interface)
 {
-    QVirtioMMIODevice *dev;
-    uint32_t magic;
-    dev = g_malloc0(sizeof(*dev));
+    QVirtioMMIODevice *virtio_mmio = obj;
+    if (!g_strcmp0(interface, "virtio")) {
+        return &virtio_mmio->vdev;
+    }
+    fprintf(stderr, "%s not present in virtio-mmio\n", interface);
+    g_assert_not_reached();
+}
+
+static void qvirtio_mmio_start_hw(QOSGraphObject *obj)
+{
+    QVirtioMMIODevice *dev = (QVirtioMMIODevice *) obj;
+    qvirtio_start_device(&dev->vdev);
+}
 
+void qvirtio_mmio_init_device(QVirtioMMIODevice *dev, uint64_t addr,
+                             uint32_t page_size)
+{
+    uint32_t magic;
     magic = readl(addr + QVIRTIO_MMIO_MAGIC_VALUE);
     g_assert(magic == ('v' | 'i' << 8 | 'r' << 16 | 't' << 24));
 
@@ -203,5 +218,14 @@ QVirtioMMIODevice *qvirtio_mmio_init_device(uint64_t addr, uint32_t page_size)
 
     writel(addr + QVIRTIO_MMIO_GUEST_PAGE_SIZE, page_size);
 
-    return dev;
+    dev->obj.get_driver = qvirtio_mmio_get_driver;
+    dev->obj.start_hw = qvirtio_mmio_start_hw;
+}
+
+static void virtio_mmio_register_nodes(void)
+{
+    qos_node_create_driver("virtio-mmio", NULL);
+    qos_node_produces("virtio-mmio", "virtio");
 }
+
+libqos_init(virtio_mmio_register_nodes);
tests/libqos/virtio-mmio.h +4 -1
index e3e52b9ce1..aadc60d6ed 100644
@@ -11,6 +11,7 @@
 #define LIBQOS_VIRTIO_MMIO_H
 
 #include "libqos/virtio.h"
+#include "libqos/qgraph.h"
 
 #define QVIRTIO_MMIO_MAGIC_VALUE        0x000
 #define QVIRTIO_MMIO_VERSION            0x004
@@ -33,6 +34,7 @@
 #define QVIRTIO_MMIO_DEVICE_SPECIFIC    0x100
 
 typedef struct QVirtioMMIODevice {
+    QOSGraphObject obj;
     QVirtioDevice vdev;
     uint64_t addr;
     uint32_t page_size;
@@ -41,6 +43,7 @@ typedef struct QVirtioMMIODevice {
 
 extern const QVirtioBus qvirtio_mmio;
 
-QVirtioMMIODevice *qvirtio_mmio_init_device(uint64_t addr, uint32_t page_size);
+void qvirtio_mmio_init_device(QVirtioMMIODevice *dev, uint64_t addr,
+                             uint32_t page_size);
 
 #endif
tests/virtio-blk-test.c +2 -1
index 66797d0348..e60b33c38a 100644
@@ -709,7 +709,8 @@ static void mmio_basic(void)
 
     arm_test_start();
 
-    dev = qvirtio_mmio_init_device(MMIO_DEV_BASE_ADDR, MMIO_PAGE_SIZE);
+    dev = g_malloc0(sizeof(QVirtioMMIODevice));
+    qvirtio_mmio_init_device(dev, MMIO_DEV_BASE_ADDR, MMIO_PAGE_SIZE);
     g_assert(dev != NULL);
     g_assert_cmphex(dev->vdev.device_type, ==, VIRTIO_ID_BLOCK);
 
Signature · 1 line
2.17.1
#16 lore raw

PATCH 16/33 tests/qgraph: arm/virt machine node

In reply to Emanuele Giuseppe Esposito

Add arm/virt machine to the graph. This machine contains virtio-mmio, so its constructor must take care of setting it properly when called.

---
 tests/Makefile.include      |  1 +
 tests/libqos/virt-machine.c | 90 +++++++++++++++++++++++++++++++++++++
 2 files changed, 91 insertions(+)
 create mode 100644 tests/libqos/virt-machine.c
tests/Makefile.include +1 -0
index 5220136473..20cb983ed0 100644
@@ -770,6 +770,7 @@ libqos-virtio-obj-y = $(libqos-spapr-obj-y) $(libqos-pc-obj-y) tests/libqos/virt
 libqgraph-machines-obj-y = tests/libqos/x86_64_pc-machine.o
 libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o
 libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o
+libqgraph-machines-obj-y += tests/libqos/virt-machine.o
 
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/virt-machine.c new file +90 -0

90 lines not on this page · raw message

Signature · 1 line
2.17.1
#17 lore raw

PATCH 17/33 tests: virtio: separate ccw tests from libqos

In reply to Emanuele Giuseppe Esposito

From: Paolo Bonzini <[email protected]>

Because qtest does not support s390 channel I/O, s390 only performs smoke tests on those few devices that do not have any functional tests. Therefore, every time we add functional tests for a virtio device, the choice is between removing those tests from the s390 suite (so that s390 actually _loses_ coverage) or sprinkling the test with architecture checks.

This patch simply creates a ccw-specific test that only performs smoke tests on all virtio-ccw devices. If channel I/O support is ever added to qtest and libqos, then this file can go away. In the meanwhile, it simplifies maintenance and makes sure that all virtio devices are tested.

---
 tests/Makefile.include  |   5 +-
 tests/virtio-ccw-test.c | 121 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 123 insertions(+), 3 deletions(-)
 create mode 100644 tests/virtio-ccw-test.c
tests/Makefile.include +2 -3
index 20cb983ed0..0e0bebf783 100644
@@ -397,9 +397,7 @@ check-qtest-s390x-$(CONFIG_SLIRP) += tests/test-netfilter$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
 check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-console-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF)
+check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
 check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
 
 check-qtest-generic-y += tests/machine-none-test$(EXESUF)
@@ -824,6 +822,7 @@ tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o
 tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y)
 tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o $(libqos-virtio-obj-y)
 tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y)
+tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y)
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y)
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
tests/virtio-ccw-test.c new file +121 -0

121 lines not on this page · raw message

Signature · 1 line
2.17.1
#18 lore raw

PATCH 18/33 tests/qgraph: virtio-serial driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-serial-pci and virtio-serial-device. Both nodes produce virtio-serial, but virtio-serial-pci receives a pci-bus and uses virtio-pci QOSGraphObject and functions, while virtio-serial-device receives a virtio and implements its own functions

---
 tests/Makefile.include       |   3 +
 tests/libqos/virtio-serial.c | 109 +++++++++++++++++++++++++++++++++++
 tests/libqos/virtio-serial.h |  39 +++++++++++++
 3 files changed, 151 insertions(+)
 create mode 100644 tests/libqos/virtio-serial.c
 create mode 100644 tests/libqos/virtio-serial.h
tests/Makefile.include +3 -0
index 0e0bebf783..409475eafd 100644
@@ -770,8 +770,11 @@ libqgraph-machines-obj-y += tests/libqos/raspi2-machine.o
 libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o
 libqgraph-machines-obj-y += tests/libqos/virt-machine.o
 
+libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o
+
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
+libqgraph-pci-obj-y += $(libqgraph-virtio-obj-y)
 libqgraph-pci-obj-y += tests/libqos/sdhci.o
 libqgraph-pci-obj-y += tests/libqos/e1000e.o
 
tests/libqos/virtio-serial.c new file +109 -0

109 lines not on this page · raw message

tests/libqos/virtio-serial.h new file +39 -0
new file mode 100644
index 0000000000..b7e2a5d178
@@ -0,0 +1,39 @@
+/*
+ * libqos driver framework
+ *
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "libqos/qgraph.h"
+#include "libqos/virtio.h"
+#include "libqos/virtio-pci.h"
+
+typedef struct QVirtioSerial QVirtioSerial;
+typedef struct QVirtioSerialPCI QVirtioSerialPCI;
+typedef struct QVirtioSerialDevice QVirtioSerialDevice;
+
+struct QVirtioSerial {
+    QVirtioDevice *vdev;
+};
+
+struct QVirtioSerialPCI {
+    QVirtioPCIDevice pci_vdev;
+    QVirtioSerial serial;
+};
+
+struct QVirtioSerialDevice {
+    QOSGraphObject obj;
+    QVirtioSerial serial;
+};
Signature · 1 line
2.17.1
#19 lore raw

PATCH 19/33 tests/qgraph: virtio-console test node

In reply to Emanuele Giuseppe Esposito

Convert tests/virtio-console-test in qgraph test node, virtio-console-test. This test consumes a virtio-serial interface and checks that its function return the expected values.

Note that this test does not allocate any virtio-console structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include      |  5 +++--
 tests/libqos/virtio.c       |  1 +
 tests/virtio-console-test.c | 30 +++++++++++++++---------------
 3 files changed, 19 insertions(+), 17 deletions(-)
tests/Makefile.include +3 -2
index 409475eafd..a160059758 100644
@@ -187,7 +187,6 @@ gcov-files-ipack-y += hw/ipack/ipack.c
 check-qtest-ipack-y += tests/ipoctal232-test$(EXESUF)
 gcov-files-ipack-y += hw/char/ipoctal232.c
 
-check-qtest-virtioserial-y += tests/virtio-console-test$(EXESUF)
 gcov-files-virtioserial-y += hw/char/virtio-console.c
 
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
@@ -398,6 +397,8 @@ check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
 check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
+check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
+check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF)
 check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
 
 check-qtest-generic-y += tests/machine-none-test$(EXESUF)
@@ -781,6 +782,7 @@ libqgraph-pci-obj-y += tests/libqos/e1000e.o
 libqgraph-tests-obj-y = $(libqgraph-pci-obj-y)
 libqgraph-tests-obj-y += tests/sdhci-test.o
 libqgraph-tests-obj-y += tests/e1000e-test.o
+libqgraph-tests-obj-y += tests/virtio-console-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -831,7 +833,6 @@ tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y)
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
 tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o $(libqos-virtio-obj-y)
 tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o $(libqos-virtio-obj-y)
-tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o $(libqos-virtio-obj-y)
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/display-vga-test$(EXESUF): tests/display-vga-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
tests/libqos/virtio.c +1 -0
index c1ff0206d5..6c2124523e 100644
@@ -352,6 +352,7 @@ void qvirtqueue_set_used_event(QVirtQueue *vq, uint16_t idx)
 /*
  * qvirtio_get_dev_type:
  * Returns: the preferred virtio bus/device type for the current architecture.
+ * TODO: delete this
  */
 const char *qvirtio_get_dev_type(void)
 {
tests/virtio-console-test.c +15 -15
index 945bae5a15..336078f1c0 100644
@@ -10,29 +10,29 @@
 #include "qemu/osdep.h"
 #include "libqtest.h"
 #include "libqos/virtio.h"
+#include "libqos/qgraph.h"
 
 /* Tests only initialization so far. TODO: Replace with functional tests */
-static void console_nop(void)
+static void console_nop(void *obj, void *data, QGuestAllocator *alloc)
 {
-    global_qtest = qtest_startf("-device virtio-serial-%s,id=vser0 "
-                                "-device virtconsole,bus=vser0.0",
-                                qvirtio_get_dev_type());
-    qtest_end();
+    /* no operation */
 }
 
-static void serialport_nop(void)
+static void serialport_nop(void *obj, void *data, QGuestAllocator *alloc)
 {
-    global_qtest = qtest_startf("-device virtio-serial-%s,id=vser0 "
-                                "-device virtserialport,bus=vser0.0",
-                                qvirtio_get_dev_type());
-    qtest_end();
+    /* no operation */
 }
 
-int main(int argc, char **argv)
+static void register_virtio_console_test(void)
 {
-    g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/virtio/console/nop", console_nop);
-    qtest_add_func("/virtio/serialport/nop", serialport_nop);
+    QOSGraphTestOptions opts = { };
+    QOSGraphEdgeOptions *edge_opts = &opts.edge;
 
-    return g_test_run();
+    edge_opts->before_cmd_line = "-device virtconsole,bus=vser0.0";
+    qos_add_test("console-nop", "virtio-serial", console_nop, &opts);
+
+    edge_opts->before_cmd_line = "-device virtserialport,bus=vser0.0";
+    qos_add_test("serialport-nop", "virtio-serial", serialport_nop, &opts);
 }
+
+libqos_init(register_virtio_console_test);
Signature · 1 line
2.17.1
#20 lore raw

PATCH 20/33 tests/qgraph: virtio-serial test node

In reply to Emanuele Giuseppe Esposito

Convert tests/virtio-serial-test in qgraph test node, virtio-serial-test. This test consumes a virtio-serial interface and checks that its function return the expected values.

Note that this test does not allocate any virtio-serial structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include     |  4 +---
 tests/virtio-serial-test.c | 27 +++++++++------------------
 2 files changed, 10 insertions(+), 21 deletions(-)
tests/Makefile.include +1 -3
index a160059758..eafceefc12 100644
@@ -205,7 +205,6 @@ check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
 gcov-files-virtio-y += hw/9pfs/virtio-9p.c
 gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
 endif
-check-qtest-virtio-y += tests/virtio-serial-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/char/virtio-serial-bus.c
 check-qtest-virtio-y += $(check-qtest-virtioserial-y)
 gcov-files-virtio-y += $(gcov-files-virtioserial-y)
@@ -398,7 +397,6 @@ check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
 check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF)
 check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
 
 check-qtest-generic-y += tests/machine-none-test$(EXESUF)
@@ -782,6 +780,7 @@ libqgraph-pci-obj-y += tests/libqos/e1000e.o
 libqgraph-tests-obj-y = $(libqgraph-pci-obj-y)
 libqgraph-tests-obj-y += tests/sdhci-test.o
 libqgraph-tests-obj-y += tests/e1000e-test.o
+libqgraph-tests-obj-y += tests/virtio-serial-test.o
 libqgraph-tests-obj-y += tests/virtio-console-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
@@ -832,7 +831,6 @@ tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(lib
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y)
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
 tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o $(libqos-virtio-obj-y)
-tests/virtio-serial-test$(EXESUF): tests/virtio-serial-test.o $(libqos-virtio-obj-y)
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/display-vga-test$(EXESUF): tests/display-vga-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
tests/virtio-serial-test.c +9 -18
index 7cc7060264..3dcac93011 100644
@@ -9,33 +9,24 @@
 
 #include "qemu/osdep.h"
 #include "libqtest.h"
-#include "libqos/virtio.h"
+#include "libqos/virtio-serial.h"
 
 /* Tests only initialization so far. TODO: Replace with functional tests */
-static void virtio_serial_nop(void)
+static void virtio_serial_nop(void *obj, void *data, QGuestAllocator *alloc)
 {
+    /* no operation */
 }
 
-static void hotplug(void)
+static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc)
 {
     qtest_qmp_device_add("virtserialport", "hp-port", NULL);
-
     qtest_qmp_device_del("hp-port");
 }
 
-int main(int argc, char **argv)
+static void register_virtio_serial_test(void)
 {
-    int ret;
-
-    g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/virtio/serial/nop", virtio_serial_nop);
-    qtest_add_func("/virtio/serial/hotplug", hotplug);
-
-    global_qtest = qtest_startf("-device virtio-serial-%s",
-                                qvirtio_get_dev_type());
-    ret = g_test_run();
-
-    qtest_end();
-
-    return ret;
+    qos_add_test("serial-nop", "virtio-serial", virtio_serial_nop, NULL);
+    qos_add_test("serial-hotplug", "virtio-serial", serial_hotplug, NULL);
 }
+
+libqos_init(register_virtio_serial_test);
Signature · 1 line
2.17.1
#21 lore raw

PATCH 21/33 tests/qgraph: virtio-9p driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-9p-pci and virtio-9p-device. Both nodes produce virtio-9p, but virtio-9p-pci receives a pci-bus and overrides virtio-pci QOSGraphObject and its functions, while virtio-9p-device receives a virtio and implements its own functions

---
 tests/Makefile.include   |   1 +
 tests/libqos/virtio-9p.c | 165 +++++++++++++++++++++++++++++++++++++++
 tests/libqos/virtio-9p.h |  42 ++++++++++
 3 files changed, 208 insertions(+)
 create mode 100644 tests/libqos/virtio-9p.c
 create mode 100644 tests/libqos/virtio-9p.h
tests/Makefile.include +1 -0
index eafceefc12..48d3aab447 100644
@@ -770,6 +770,7 @@ libqgraph-machines-obj-y += tests/libqos/ppc64_pseries-machine.o
 libqgraph-machines-obj-y += tests/libqos/virt-machine.o
 
 libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o
+libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o
 
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/virtio-9p.c new file +165 -0

165 lines not on this page · raw message

tests/libqos/virtio-9p.h new file +42 -0

42 lines not on this page · raw message

Signature · 1 line
2.17.1
#22 lore raw

PATCH 22/33 tests/qgraph: virtio-9p test node

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-9p-pci and virtio-9p-device. Both nodes produce virtio-9p, but virtio-9p-pci receives a pci-bus and uses virtio-pci QOSGraphObject and functions, while virtio-9p-device receives a virtio and implements its own functions

---
 tests/Makefile.include |   3 +-
 tests/virtio-9p-test.c | 219 +++++++++++++++--------------------------
 2 files changed, 82 insertions(+), 140 deletions(-)
tests/Makefile.include +1 -2
index 48d3aab447..495ff5ca9b 100644
@@ -201,7 +201,6 @@ gcov-files-virtio-y += hw/virtio/virtio-rng.c
 check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
 ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
-check-qtest-virtio-y += tests/virtio-9p-test$(EXESUF)
 gcov-files-virtio-y += hw/9pfs/virtio-9p.c
 gcov-files-virtio-y += i386-softmmu/hw/9pfs/virtio-9p-device.c
 endif
@@ -783,6 +782,7 @@ libqgraph-tests-obj-y += tests/sdhci-test.o
 libqgraph-tests-obj-y += tests/e1000e-test.o
 libqgraph-tests-obj-y += tests/virtio-serial-test.o
 libqgraph-tests-obj-y += tests/virtio-console-test.o
+libqgraph-tests-obj-y += tests/virtio-9p-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -831,7 +831,6 @@ tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y)
 tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y)
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
-tests/virtio-9p-test$(EXESUF): tests/virtio-9p-test.o $(libqos-virtio-obj-y)
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/display-vga-test$(EXESUF): tests/display-vga-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
tests/virtio-9p-test.c +81 -138

421 lines not on this page · raw message

Signature · 1 line
2.17.1
#23 lore raw

PATCH 23/33 tests/qgraph: virtio-balloon driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-balloon-pci and virtio-balloon-device. Both nodes produce virtio-balloon, but virtio-balloon-pci receives a pci-bus and uses virtio-pci QOSGraphObject and functions, while virtio-balloon-device receives a virtio and implements its own functions

---
 tests/Makefile.include        |   1 +
 tests/libqos/virtio-balloon.c | 111 ++++++++++++++++++++++++++++++++++
 tests/libqos/virtio-balloon.h |  39 ++++++++++++
 3 files changed, 151 insertions(+)
 create mode 100644 tests/libqos/virtio-balloon.c
 create mode 100644 tests/libqos/virtio-balloon.h
tests/Makefile.include +1 -0
index 495ff5ca9b..362d9ec4b2 100644
@@ -770,6 +770,7 @@ libqgraph-machines-obj-y += tests/libqos/virt-machine.o
 
 libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o
+libqgraph-virtio-obj-y += tests/libqos/virtio-balloon.o
 
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/virtio-balloon.c new file +111 -0

111 lines not on this page · raw message

tests/libqos/virtio-balloon.h new file +39 -0
new file mode 100644
index 0000000000..e8066c42bb
@@ -0,0 +1,39 @@
+/*
+ * libqos driver framework
+ *
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "libqos/qgraph.h"
+#include "libqos/virtio.h"
+#include "libqos/virtio-pci.h"
+
+typedef struct QVirtioBalloon QVirtioBalloon;
+typedef struct QVirtioBalloonPCI QVirtioBalloonPCI;
+typedef struct QVirtioBalloonDevice QVirtioBalloonDevice;
+
+struct QVirtioBalloon {
+    QVirtioDevice *vdev;
+};
+
+struct QVirtioBalloonPCI {
+    QVirtioPCIDevice pci_vdev;
+    QVirtioBalloon balloon;
+};
+
+struct QVirtioBalloonDevice {
+    QOSGraphObject obj;
+    QVirtioBalloon balloon;
+};
Signature · 1 line
2.17.1
#24 lore raw

PATCH 24/33 tests/qgraph: virtio-balloon test node

In reply to Emanuele Giuseppe Esposito

Convert tests/virtio-balloon-test in qgraph test node, virtio-balloon-test. This test consumes a virtio-balloon interface and checks that its function return the expected values.

Note that this test does not allocate any virtio-balloon structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include      |  4 +---
 tests/virtio-balloon-test.c | 22 +++++++---------------
 2 files changed, 8 insertions(+), 18 deletions(-)
tests/Makefile.include +1 -3
index 362d9ec4b2..b23597972d 100644
@@ -192,7 +192,6 @@ gcov-files-virtioserial-y += hw/char/virtio-console.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
-check-qtest-virtio-y += tests/virtio-balloon-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
 check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
@@ -395,7 +394,6 @@ check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
 check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
 check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
 check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
 check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
 
 check-qtest-generic-y += tests/machine-none-test$(EXESUF)
@@ -784,6 +782,7 @@ libqgraph-tests-obj-y += tests/e1000e-test.o
 libqgraph-tests-obj-y += tests/virtio-serial-test.o
 libqgraph-tests-obj-y += tests/virtio-console-test.o
 libqgraph-tests-obj-y += tests/virtio-9p-test.o
+libqgraph-tests-obj-y += tests/virtio-balloon-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -826,7 +825,6 @@ 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-balloon-test$(EXESUF): tests/virtio-balloon-test.o $(libqos-virtio-obj-y)
 tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y)
 tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y)
tests/virtio-balloon-test.c +7 -15
index 0a07e036bb..8499a2349d 100644
@@ -9,25 +9,17 @@
 
 #include "qemu/osdep.h"
 #include "libqtest.h"
-#include "libqos/virtio.h"
+#include "libqos/qgraph.h"
+#include "libqos/virtio-balloon.h"
 
 /* Tests only initialization so far. TODO: Replace with functional tests */
-static void balloon_nop(void)
+static void balloon_nop(void *obj, void *data, QGuestAllocator *alloc)
 {
 }
 
-int main(int argc, char **argv)
+static void register_virtio_balloon_test(void)
 {
-    int ret;
-
-    g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/virtio/balloon/nop", balloon_nop);
-
-    global_qtest = qtest_startf("-device virtio-balloon-%s",
-                                qvirtio_get_dev_type());
-    ret = g_test_run();
-
-    qtest_end();
-
-    return ret;
+    qos_add_test("balloon-nop", "virtio-balloon", balloon_nop, NULL);
 }
+
+libqos_init(register_virtio_balloon_test);
Signature · 1 line
2.17.1
#25 lore raw

PATCH 25/33 tests/qgraph: virtio-rng driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-rng-pci and virtio-rng-device. Both nodes produce virtio-rng, but virtio-rng-pci receives a pci-bus and uses virtio-pci QOSGraphObject and functions, while virtio-rng-device receives a virtio and implements its own functions

---
 tests/Makefile.include    |   1 +
 tests/libqos/virtio-rng.c | 108 ++++++++++++++++++++++++++++++++++++++
 tests/libqos/virtio-rng.h |  39 ++++++++++++++
 3 files changed, 148 insertions(+)
 create mode 100644 tests/libqos/virtio-rng.c
 create mode 100644 tests/libqos/virtio-rng.h
tests/Makefile.include +1 -0
index b23597972d..162187d15b 100644
@@ -769,6 +769,7 @@ libqgraph-machines-obj-y += tests/libqos/virt-machine.o
 libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-balloon.o
+libqgraph-virtio-obj-y += tests/libqos/virtio-rng.o
 
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/virtio-rng.c new file +108 -0

108 lines not on this page · raw message

tests/libqos/virtio-rng.h new file +39 -0
new file mode 100644
index 0000000000..fbba988875
@@ -0,0 +1,39 @@
+/*
+ * libqos driver framework
+ *
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "libqos/qgraph.h"
+#include "libqos/virtio.h"
+#include "libqos/virtio-pci.h"
+
+typedef struct QVirtioRng QVirtioRng;
+typedef struct QVirtioRngPCI QVirtioRngPCI;
+typedef struct QVirtioRngDevice QVirtioRngDevice;
+
+struct QVirtioRng {
+    QVirtioDevice *vdev;
+};
+
+struct QVirtioRngPCI {
+    QVirtioPCIDevice pci_vdev;
+    QVirtioRng rng;
+};
+
+struct QVirtioRngDevice {
+    QOSGraphObject obj;
+    QVirtioRng rng;
+};
Signature · 1 line
2.17.1
#26 lore raw

PATCH 26/33 tests/qgraph: virtio-rng test node

In reply to Emanuele Giuseppe Esposito

Convert tests/virtio-rng-test in qgraph test node, virtio-rng-test. This test consumes a virtio-rng interface and checks that its function return the expected values.

Some functions are implemented only for virtio-rng-pci, so they don't consume virtio-rng, but virtio-rng-pci

Note that this test does not allocate any virtio-rng structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include  |  3 +--
 tests/virtio-rng-test.c | 25 +++++++++----------------
 2 files changed, 10 insertions(+), 18 deletions(-)
tests/Makefile.include +1 -2
index 162187d15b..cc1e1396f1 100644
@@ -195,7 +195,6 @@ gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
 check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
-check-qtest-virtio-y += tests/virtio-rng-test$(EXESUF)
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
 check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
@@ -784,6 +783,7 @@ libqgraph-tests-obj-y += tests/virtio-serial-test.o
 libqgraph-tests-obj-y += tests/virtio-console-test.o
 libqgraph-tests-obj-y += tests/virtio-9p-test.o
 libqgraph-tests-obj-y += tests/virtio-balloon-test.o
+libqgraph-tests-obj-y += tests/virtio-rng-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -829,7 +829,6 @@ tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y)
 tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y)
 tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y)
-tests/virtio-rng-test$(EXESUF): tests/virtio-rng-test.o $(libqos-pc-obj-y)
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/display-vga-test$(EXESUF): tests/display-vga-test.o
tests/virtio-rng-test.c +9 -16
index dcecf77463..fd67922b66 100644
@@ -9,16 +9,17 @@
 
 #include "qemu/osdep.h"
 #include "libqtest.h"
-#include "libqos/pci.h"
+#include "libqos/qgraph.h"
+#include "libqos/virtio-rng.h"
 
 #define PCI_SLOT_HP             0x06
 
 /* Tests only initialization so far. TODO: Replace with functional tests */
-static void pci_nop(void)
+static void nop(void *obj, void *data, QGuestAllocator *alloc)
 {
 }
 
-static void hotplug(void)
+static void rng_hotplug(void *obj, void *data, QGuestAllocator *alloc)
 {
     const char *arch = qtest_get_arch();
 
@@ -29,18 +30,10 @@ static void hotplug(void)
     }
 }
 
-int main(int argc, char **argv)
+static void register_virtio_rng_test(void)
 {
-    int ret;
-
-    g_test_init(&argc, &argv, NULL);
-    qtest_add_func("/virtio/rng/pci/nop", pci_nop);
-    qtest_add_func("/virtio/rng/pci/hotplug", hotplug);
-
-    qtest_start("-device virtio-rng-pci");
-    ret = g_test_run();
-
-    qtest_end();
-
-    return ret;
+    qos_add_test("rng-nop", "virtio-rng", nop, NULL);
+    qos_add_test("rng-hotplug", "virtio-rng-pci", rng_hotplug, NULL);
 }
+
+libqos_init(register_virtio_rng_test);
Signature · 1 line
2.17.1
#27 lore raw

PATCH 27/33 tests/qgraph: virtio-blk driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-blk-pci and virtio-blk-device. Both nodes produce virtio-blk, but virtio-blk-pci receives a pci-bus and uses virtio-pci QOSGraphObject and functions, while virtio-blk-device receives a virtio and implements its own functions

---
 tests/Makefile.include    |   1 +
 tests/libqos/virtio-blk.c | 126 ++++++++++++++++++++++++++++++++++++++
 tests/libqos/virtio-blk.h |  40 ++++++++++++
 3 files changed, 167 insertions(+)
 create mode 100644 tests/libqos/virtio-blk.c
 create mode 100644 tests/libqos/virtio-blk.h
tests/Makefile.include +1 -0
index cc1e1396f1..340c2462d2 100644
@@ -769,6 +769,7 @@ libqgraph-virtio-obj-y = tests/libqos/virtio-serial.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-balloon.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-rng.o
+libqgraph-virtio-obj-y += tests/libqos/virtio-blk.o
 
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/virtio-blk.c new file +126 -0

126 lines not on this page · raw message

tests/libqos/virtio-blk.h new file +40 -0
new file mode 100644
index 0000000000..dc258496ba
@@ -0,0 +1,40 @@
+/*
+ * libqos driver framework
+ *
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "libqos/qgraph.h"
+#include "libqos/virtio.h"
+#include "libqos/virtio-pci.h"
+
+typedef struct QVirtioBlk QVirtioBlk;
+typedef struct QVirtioBlkPCI QVirtioBlkPCI;
+typedef struct QVirtioBlkDevice QVirtioBlkDevice;
+
+/* virtqueue is created in each test */
+struct QVirtioBlk {
+    QVirtioDevice *vdev;
+};
+
+struct QVirtioBlkPCI {
+    QVirtioPCIDevice pci_vdev;
+    QVirtioBlk blk;
+};
+
+struct QVirtioBlkDevice {
+    QOSGraphObject obj;
+    QVirtioBlk blk;
+};
Signature · 1 line
2.17.1
#29 lore raw

PATCH 29/33 tests/qgraph: virtio-net driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-net-pci and virtio-net-device. Both nodes produce virtio-net, but virtio-net-pci receives a pci-bus and overrides virtio-pci QOSGraphObject and its functions, while virtio-net-device receives a virtio and implements its own functions

---
 tests/Makefile.include    |   1 +
 tests/libqos/virtio-net.c | 179 ++++++++++++++++++++++++++++++++++++++
 tests/libqos/virtio-net.h |  41 +++++++++
 3 files changed, 221 insertions(+)
 create mode 100644 tests/libqos/virtio-net.c
 create mode 100644 tests/libqos/virtio-net.h
tests/Makefile.include +1 -0
index 814cef85c7..c105c0902c 100644
@@ -768,6 +768,7 @@ libqgraph-virtio-obj-y += tests/libqos/virtio-9p.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-balloon.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-rng.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-blk.o
+libqgraph-virtio-obj-y += tests/libqos/virtio-net.o
 
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/virtio-net.c new file +179 -0

179 lines not on this page · raw message

tests/libqos/virtio-net.h new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.17.1
#28 lore raw

PATCH 28/33 tests/qgraph: virtio-blk test node

In reply to Emanuele Giuseppe Esposito

Convert tests/virtio-blk-test in qgraph test node, virtio-blk-test. This test consumes a virtio-blk interface and checks that its function return the expected values.

Some functions are implemented only for virtio-blk-pci, so they don't consume virtio-blk, but virtio-blk-pci

Note that this test does not allocate any virtio-blk structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include  |   4 +-
 tests/virtio-blk-test.c | 468 ++++++++++++++++------------------------
 2 files changed, 190 insertions(+), 282 deletions(-)
tests/Makefile.include +1 -3
index 340c2462d2..814cef85c7 100644
@@ -193,7 +193,6 @@ gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
 check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
-check-qtest-virtio-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
 check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
@@ -373,7 +372,6 @@ check-qtest-arm-y += tests/pca9552-test$(EXESUF)
 check-qtest-arm-y += tests/ds1338-test$(EXESUF)
 check-qtest-arm-y += tests/m25p80-test$(EXESUF)
 gcov-files-arm-y += hw/misc/tmp105.c
-check-qtest-arm-y += tests/virtio-blk-test$(EXESUF)
 gcov-files-arm-y += arm-softmmu/hw/block/virtio-blk.c
 check-qtest-arm-y += tests/test-arm-mptimer$(EXESUF)
 gcov-files-arm-y += hw/timer/arm_mptimer.c
@@ -785,6 +783,7 @@ libqgraph-tests-obj-y += tests/virtio-console-test.o
 libqgraph-tests-obj-y += tests/virtio-9p-test.o
 libqgraph-tests-obj-y += tests/virtio-balloon-test.o
 libqgraph-tests-obj-y += tests/virtio-rng-test.o
+libqgraph-tests-obj-y += tests/virtio-blk-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -827,7 +826,6 @@ 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-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-y)
 tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o
 tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y)
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
tests/virtio-blk-test.c +189 -279

745 lines not on this page · raw message

Signature · 1 line
2.17.1
#30 lore raw

PATCH 30/33 tests/qgraph: virtio-net test node

In reply to Emanuele Giuseppe Esposito

Convert tests/virtio-net-test in qgraph test node, virtio-net-test. This test consumes a virtio-net interface and checks that its function return the expected values.

Some functions are implemented only for virtio-net-pci, so they don't consume virtio-net, but virtio-net-pci

Note that this test does not allocate any virtio-net structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include  |   3 +-
 tests/virtio-net-test.c | 161 ++++++++++++----------------------------
 2 files changed, 49 insertions(+), 115 deletions(-)
tests/Makefile.include +1 -2
index c105c0902c..7a2b67c1ec 100644
@@ -190,7 +190,6 @@ gcov-files-ipack-y += hw/char/ipoctal232.c
 gcov-files-virtioserial-y += hw/char/virtio-console.c
 
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio.c
-check-qtest-virtio-y += tests/virtio-net-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
@@ -785,6 +784,7 @@ libqgraph-tests-obj-y += tests/virtio-9p-test.o
 libqgraph-tests-obj-y += tests/virtio-balloon-test.o
 libqgraph-tests-obj-y += tests/virtio-rng-test.o
 libqgraph-tests-obj-y += tests/virtio-blk-test.o
+libqgraph-tests-obj-y += tests/virtio-net-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/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
-tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y) $(libqos-virtio-obj-y)
 tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/display-vga-test$(EXESUF): tests/display-vga-test.o
tests/virtio-net-test.c +48 -113

205 lines not on this page · raw message

Signature · 1 line
2.17.1
#31 lore raw

PATCH 31/33 tests/qgraph: virtio-scsi driver and interface nodes

In reply to Emanuele Giuseppe Esposito

Add qgraph nodes for virtio-scsi-pci and virtio-scsi-device. Both nodes produce virtio-scsi, but virtio-scsi-pci receives a pci-bus and uses virtio-pci QOSGraphObject and its functions, while virtio-scsi-device receives a virtio and implements its own functions

---
 tests/Makefile.include     |   1 +
 tests/libqos/virtio-scsi.c | 117 +++++++++++++++++++++++++++++++++++++
 tests/libqos/virtio-scsi.h |  39 +++++++++++++
 3 files changed, 157 insertions(+)
 create mode 100644 tests/libqos/virtio-scsi.c
 create mode 100644 tests/libqos/virtio-scsi.h
tests/Makefile.include +1 -0
index 7a2b67c1ec..a839763505 100644
@@ -768,6 +768,7 @@ libqgraph-virtio-obj-y += tests/libqos/virtio-balloon.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-rng.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-blk.o
 libqgraph-virtio-obj-y += tests/libqos/virtio-net.o
+libqgraph-virtio-obj-y += tests/libqos/virtio-scsi.o
 
 libqgraph-pci-obj-y = $(libqos-virtio-obj-y)
 libqgraph-pci-obj-y += $(libqgraph-machines-obj-y)
tests/libqos/virtio-scsi.c new file +117 -0

117 lines not on this page · raw message

tests/libqos/virtio-scsi.h new file +39 -0
new file mode 100644
index 0000000000..17a47beddc
@@ -0,0 +1,39 @@
+/*
+ * libqos driver framework
+ *
+ * Copyright (c) 2018 Emanuele Giuseppe Esposito <[email protected]>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>
+ */
+
+#include "libqos/qgraph.h"
+#include "libqos/virtio.h"
+#include "libqos/virtio-pci.h"
+
+typedef struct QVirtioSCSI QVirtioSCSI;
+typedef struct QVirtioSCSIPCI QVirtioSCSIPCI;
+typedef struct QVirtioSCSIDevice QVirtioSCSIDevice;
+
+struct QVirtioSCSI {
+    QVirtioDevice *vdev;
+};
+
+struct QVirtioSCSIPCI {
+    QVirtioPCIDevice pci_vdev;
+    QVirtioSCSI scsi;
+};
+
+struct QVirtioSCSIDevice {
+    QOSGraphObject obj;
+    QVirtioSCSI scsi;
+};
Signature · 1 line
2.17.1
#32 lore raw

PATCH 32/33 tests/qgraph: virtio-scsi test node

In reply to Emanuele Giuseppe Esposito

Convert tests/virtio-scsi-test in qgraph test node, virtio-scsi-test. This test consumes a virtio-scsi interface and checks that its function return the expected values.

Some functions are implemented only for virtio-scsi-pci, so they don't consume virtio-scsi, but virtio-scsi-pci

Note that this test does not allocate any virtio-scsi structure, it's all done by the qtest walking graph mechanism

---
 tests/Makefile.include   |   3 +-
 tests/virtio-scsi-test.c | 153 +++++++++++++++++++--------------------
 2 files changed, 75 insertions(+), 81 deletions(-)
tests/Makefile.include +1 -2
index a839763505..15926cc95f 100644
@@ -194,7 +194,6 @@ gcov-files-virtio-y += i386-softmmu/hw/net/virtio-net.c
 gcov-files-virtio-y += i386-softmmu/hw/virtio/virtio-balloon.c
 gcov-files-virtio-y += i386-softmmu/hw/block/virtio-blk.c
 gcov-files-virtio-y += hw/virtio/virtio-rng.c
-check-qtest-virtio-y += tests/virtio-scsi-test$(EXESUF)
 gcov-files-virtio-y += i386-softmmu/hw/scsi/virtio-scsi.c
 ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy)
 gcov-files-virtio-y += hw/9pfs/virtio-9p.c
@@ -786,6 +785,7 @@ libqgraph-tests-obj-y += tests/virtio-balloon-test.o
 libqgraph-tests-obj-y += tests/virtio-rng-test.o
 libqgraph-tests-obj-y += tests/virtio-blk-test.o
 libqgraph-tests-obj-y += tests/virtio-net-test.o
+libqgraph-tests-obj-y += tests/virtio-scsi-test.o
 
 check-unit-y += tests/test-qgraph$(EXESUF)
 tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y)
@@ -829,7 +829,6 @@ 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
-tests/virtio-scsi-test$(EXESUF): tests/virtio-scsi-test.o $(libqos-virtio-obj-y)
 tests/tpci200-test$(EXESUF): tests/tpci200-test.o
 tests/display-vga-test$(EXESUF): tests/display-vga-test.o
 tests/ipoctal232-test$(EXESUF): tests/ipoctal232-test.o
tests/virtio-scsi-test.c +74 -79

238 lines not on this page · raw message

Signature · 1 line
2.17.1
#33 lore raw

PATCH 33/33 tests/qgraph: temporarly commented vhost-user-test

In reply to Emanuele Giuseppe Esposito

vhost-user-test has not converted to qgraph yet, and since it uses virtio interface, it won't work, causing make check to fail.
Commented out until it does not get converted to graph node.

---
 tests/Makefile.include | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/Makefile.include +4 -4
index 15926cc95f..30355058fc 100644
@@ -287,10 +287,10 @@ check-qtest-i386-y += tests/cpu-plug-test$(EXESUF)
 check-qtest-i386-y += tests/q35-test$(EXESUF)
 check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
 gcov-files-i386-y += hw/pci-host/q35.c
-check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF)
-ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
-check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF)
-endif
+# check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF)
+# ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
+# check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF)
+# endif
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-swtpm-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-tis-swtpm-test$(EXESUF)
Signature · 1 line
2.17.1
#34 lore raw

Re: [Qemu-devel] [PATCH 33/33] tests/qgraph: temporarly commented vhost-user-test

Quoted 6 lines · Emanuele Giuseppe Esposito

vhost-user-test has not converted to qgraph yet, and since it uses virtio interface, it won't work, causing make check to fail.
Commented out until it does not get converted to graph node.

Two problems with that
- we lose vhost user coverage
- bisecting to before patch 33 will leave us with
a failing make check

Thoughts?

Quoted 25 lines
---
 tests/Makefile.include | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/Makefile.include +4 -4
index 15926cc95f..30355058fc 100644
@@ -287,10 +287,10 @@ check-qtest-i386-y += tests/cpu-plug-test$(EXESUF)
 check-qtest-i386-y += tests/q35-test$(EXESUF)
 check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
 gcov-files-i386-y += hw/pci-host/q35.c
-check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF)
-ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
-check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF)
-endif
+# check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF)
+# ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
+# check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF)
+# endif
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-swtpm-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-tis-swtpm-test$(EXESUF)
Signature · 1 line
2.17.1
#35 lore raw

Re: [Qemu-devel] [PATCH 33/33] tests/qgraph: temporarly commented vhost-user-test

Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Emanuele Giuseppe Esposito

vhost-user-test has not converted to qgraph yet, and since it uses virtio interface, it won't work, causing make check to fail.
Commented out until it does not get converted to graph node.

Quoted 6 lines
Quoted 1 line

Two problems with that
- we lose vhost user coverage
- bisecting to before patch 33 will leave us with
a failing make check

See $SUBJECT, "temporarily". :)

Paolo

Quoted 26 lines
Quoted 26 lines
---
 tests/Makefile.include | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tests/Makefile.include +4 -4
index 15926cc95f..30355058fc 100644
@@ -287,10 +287,10 @@ check-qtest-i386-y += tests/cpu-plug-test$(EXESUF)
 check-qtest-i386-y += tests/q35-test$(EXESUF)
 check-qtest-i386-y += tests/vmgenid-test$(EXESUF)
 gcov-files-i386-y += hw/pci-host/q35.c
-check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF)
-ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
-check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF)
-endif
+# check-qtest-i386-$(CONFIG_VHOST_USER_NET_TEST_i386) += tests/vhost-user-test$(EXESUF)
+# ifeq ($(CONFIG_VHOST_USER_NET_TEST_i386),)
+# check-qtest-x86_64-$(CONFIG_VHOST_USER_NET_TEST_x86_64) += tests/vhost-user-test$(EXESUF)
+# endif
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-swtpm-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-crb-test$(EXESUF)
 check-qtest-i386-$(CONFIG_TPM) += tests/tpm-tis-swtpm-test$(EXESUF)
Signature · 1 line
2.17.1
Acked-by on the v1 series
#36 lore raw
In reply to Emanuele Giuseppe Esposito
Quoted 33 lines · Emanuele Giuseppe Esposito

Qgraph API for the qtest driver framework

This series of patches introduce a different qtest driver organization, viewing machines, drivers and tests as node in a graph, each having one or multiple edges relations.

The idea is to have a framework where each test asks for a specific driver, and the framework takes care of allocating the proper devices required and passing the correct command line arguments to QEMU.

A node can be of four types:
- MACHINE: for example "arm/raspi2"
- DRIVER: for example "generic-sdhci"
- INTERFACE: for example "sdhci" (interface for all "-sdhci" drivers)
- TEST: for example "sdhci-test", consumes an interface and tests
the functions provided

An edge relation between two nodes (drivers or machines) X and Y can be:
- X CONSUMES Y: Y can be plugged into X
- X PRODUCES Y: X provides the interface Y
- X CONTAINS Y: Y is part of X component

Basic framework steps are the following:
- All nodes and edges are created in their respective machine/driver/test files
- The framework starts QEMU and asks for a list of available devices and machines
- The framework walks the graph starting from the available machines and performs a Depth First Search for tests
- Once a test is found, the path is walked again and all drivers are allocated accordingly and the final interface is passed to the test
- The test is executed
- Unused objects are cleaned and the path discovery is continued

Quoted 7 lines

Depending on the QEMU binary used, only some drivers/machines will be available and only test that are reached by them will be executed.

This work is being done as Google Summer of Code 2018 project for QEMU, my mentors are Paolo Bonzini and Laurent Vivier.
Additional infos on the project can be found at:
https://wiki.qemu.org/Features/qtest_driver_framework

Seems pretty clean to me. Except that patch 33
needs to be fixed and fix squashed:

Quoted 140 lines

v3:
- Minor fixes regarding memory leaks and naming

Emanuele Giuseppe Esposito (32):
tests: qgraph API for the qtest driver framework tests/qgraph: rename qpci_init_pc and qpci_init_spapr functions tests/qgraph: pci-pc driver and interface nodes tests/qgraph: x86_64/pc machine node
tests/qgraph: sdhci driver and interface nodes tests/qgraph: sdhci test node
tests/qgraph: arm/raspi2 machine node
tests/qgraph: pci-spapr driver and interface nodes tests/qgraph: ppc64/pseries machine node tests/qgraph: has_buggy_msi flag
tests/qgraph: e1000e driver and interface nodes tests/qgraph: e1000e-test node
tests/qgraph: virtio_start_device function tests/qgraph: virtio-pci driver and interface nodes tests/qgraph: virtio-mmio driver and interface nodes tests/qgraph: arm/virt machine node
tests/qgraph: virtio-serial driver and interface nodes tests/qgraph: virtio-console test node
tests/qgraph: virtio-serial test node
tests/qgraph: virtio-9p driver and interface nodes tests/qgraph: virtio-9p test node
tests/qgraph: virtio-balloon driver and interface nodes tests/qgraph: virtio-balloon test node
tests/qgraph: virtio-rng driver and interface nodes tests/qgraph: virtio-rng test node
tests/qgraph: virtio-blk driver and interface nodes tests/qgraph: virtio-blk test node
tests/qgraph: virtio-net driver and interface nodes tests/qgraph: virtio-net test node
tests/qgraph: virtio-scsi driver and interface nodes tests/qgraph: virtio-scsi test node
tests/qgraph: temporarly commented vhost-user-test

Paolo Bonzini (1):
tests: virtio: separate ccw tests from libqos

 configure                            |   2 +-
 include/qemu/module.h                |   2 +
 tests/Makefile.include               |  79 +--
 tests/e1000e-test.c                  | 354 +++----------
 tests/i440fx-test.c                  |   2 +-
 tests/ide-test.c                     |   2 +-
 tests/libqos/ahci.c                  |   2 +-
 tests/libqos/e1000e.c                | 262 ++++++++++
 tests/libqos/e1000e.h                |  53 ++
 tests/libqos/libqos-pc.c             |   2 +-
 tests/libqos/libqos-spapr.c          |   2 +-
 tests/libqos/libqos.c                |   2 +-
 tests/libqos/libqos.h                |   2 +-
 tests/libqos/pci-pc.c                |  86 ++--
 tests/libqos/pci-pc.h                |  22 +-
 tests/libqos/pci-spapr.c             | 119 +++--
 tests/libqos/pci-spapr.h             |  26 +-
 tests/libqos/pci.c                   |  37 +-
 tests/libqos/pci.h                   |  15 +
 tests/libqos/ppc64_pseries-machine.c | 111 +++++
 tests/libqos/qgraph.c                | 721 +++++++++++++++++++++++++++
 tests/libqos/qgraph.h                | 515 +++++++++++++++++++
 tests/libqos/qgraph_extra.h          | 263 ++++++++++
 tests/libqos/raspi2-machine.c        |  82 +++
 tests/libqos/sdhci.c                 | 163 ++++++
 tests/libqos/sdhci.h                 |  69 +++
 tests/libqos/virt-machine.c          |  90 ++++
 tests/libqos/virtio-9p.c             | 165 ++++++
 tests/libqos/virtio-9p.h             |  42 ++
 tests/libqos/virtio-balloon.c        | 111 +++++
 tests/libqos/virtio-balloon.h        |  39 ++
 tests/libqos/virtio-blk.c            | 126 +++++
 tests/libqos/virtio-blk.h            |  40 ++
 tests/libqos/virtio-mmio.c           |  66 ++-
 tests/libqos/virtio-mmio.h           |   5 +-
 tests/libqos/virtio-net.c            | 179 +++++++
 tests/libqos/virtio-net.h            |  41 ++
 tests/libqos/virtio-pci.c            |  80 ++-
 tests/libqos/virtio-pci.h            |  12 +
 tests/libqos/virtio-rng.c            | 108 ++++
 tests/libqos/virtio-rng.h            |  39 ++
 tests/libqos/virtio-scsi.c           | 117 +++++
 tests/libqos/virtio-scsi.h           |  39 ++
 tests/libqos/virtio-serial.c         | 109 ++++
 tests/libqos/virtio-serial.h         |  39 ++
 tests/libqos/virtio.c                |   8 +
 tests/libqos/virtio.h                |   1 +
 tests/libqos/x86_64_pc-machine.c     | 110 ++++
 tests/libqtest.h                     |   3 +
 tests/q35-test.c                     |   4 +-
 tests/qos-test.c                     | 481 ++++++++++++++++++
 tests/rtl8139-test.c                 |   2 +-
 tests/sdhci-test.c                   | 222 +++------
 tests/tco-test.c                     |   2 +-
 tests/test-qgraph.c                  | 446 +++++++++++++++++
 tests/usb-hcd-ehci-test.c            |   2 +-
 tests/vhost-user-test.c              |   6 +-
 tests/virtio-9p-test.c               | 221 +++-----
 tests/virtio-balloon-test.c          |  22 +-
 tests/virtio-blk-test.c              | 473 +++++++-----------
 tests/virtio-ccw-test.c              | 121 +++++
 tests/virtio-console-test.c          |  30 +-
 tests/virtio-net-test.c              | 163 ++----
 tests/virtio-rng-test.c              |  25 +-
 tests/virtio-scsi-test.c             | 155 +++---
 tests/virtio-serial-test.c           |  27 +-
 66 files changed, 5674 insertions(+), 1292 deletions(-)
 create mode 100644 tests/libqos/e1000e.c
 create mode 100644 tests/libqos/e1000e.h
 create mode 100644 tests/libqos/ppc64_pseries-machine.c
 create mode 100644 tests/libqos/qgraph.c
 create mode 100644 tests/libqos/qgraph.h
 create mode 100644 tests/libqos/qgraph_extra.h
 create mode 100644 tests/libqos/raspi2-machine.c
 create mode 100644 tests/libqos/sdhci.c
 create mode 100644 tests/libqos/sdhci.h
 create mode 100644 tests/libqos/virt-machine.c
 create mode 100644 tests/libqos/virtio-9p.c
 create mode 100644 tests/libqos/virtio-9p.h
 create mode 100644 tests/libqos/virtio-balloon.c
 create mode 100644 tests/libqos/virtio-balloon.h
 create mode 100644 tests/libqos/virtio-blk.c
 create mode 100644 tests/libqos/virtio-blk.h
 create mode 100644 tests/libqos/virtio-net.c
 create mode 100644 tests/libqos/virtio-net.h
 create mode 100644 tests/libqos/virtio-rng.c
 create mode 100644 tests/libqos/virtio-rng.h
 create mode 100644 tests/libqos/virtio-scsi.c
 create mode 100644 tests/libqos/virtio-scsi.h
 create mode 100644 tests/libqos/virtio-serial.c
 create mode 100644 tests/libqos/virtio-serial.h
 create mode 100644 tests/libqos/x86_64_pc-machine.c
 create mode 100644 tests/qos-test.c
 create mode 100644 tests/test-qgraph.c
 create mode 100644 tests/virtio-ccw-test.c
Signature · 1 line
2.17.1
#37 lore raw
In reply to Emanuele Giuseppe Esposito
Quoted 33 lines · Emanuele Giuseppe Esposito

Qgraph API for the qtest driver framework

This series of patches introduce a different qtest driver organization, viewing machines, drivers and tests as node in a graph, each having one or multiple edges relations.

The idea is to have a framework where each test asks for a specific driver, and the framework takes care of allocating the proper devices required and passing the correct command line arguments to QEMU.

A node can be of four types:
- MACHINE: for example "arm/raspi2"
- DRIVER: for example "generic-sdhci"
- INTERFACE: for example "sdhci" (interface for all "-sdhci" drivers)
- TEST: for example "sdhci-test", consumes an interface and tests
the functions provided

An edge relation between two nodes (drivers or machines) X and Y can be:
- X CONSUMES Y: Y can be plugged into X
- X PRODUCES Y: X provides the interface Y
- X CONTAINS Y: Y is part of X component

Basic framework steps are the following:
- All nodes and edges are created in their respective machine/driver/test files
- The framework starts QEMU and asks for a list of available devices and machines
- The framework walks the graph starting from the available machines and performs a Depth First Search for tests
- Once a test is found, the path is walked again and all drivers are allocated accordingly and the final interface is passed to the test
- The test is executed
- Unused objects are cleaned and the path discovery is continued

Quoted 7 lines

Depending on the QEMU binary used, only some drivers/machines will be available and only test that are reached by them will be executed.

This work is being done as Google Summer of Code 2018 project for QEMU, my mentors are Paolo Bonzini and Laurent Vivier.
Additional infos on the project can be found at:
https://wiki.qemu.org/Features/qtest_driver_framework

You've likely answered this question somewhere already, but it should be answered right here: what does this framework buy us?

I figure the main benefit is running tests in all possible contexts, with automated context setup. Instead, you feed the framework declarations of how things are related (the graph stuff described above).

Taking a step back: your cover letter describes a solution at a high level. That's good. But it should *first* describe the problem you're trying to solve.

Quoted 4 lines

v3:
- Minor fixes regarding memory leaks and naming

author
#38 lore raw
Quoted 42 lines · Markus Armbruster
Quoted 33 lines · Emanuele Giuseppe Esposito

Qgraph API for the qtest driver framework

This series of patches introduce a different qtest driver organization, viewing machines, drivers and tests as node in a graph, each having one or multiple edges relations.

The idea is to have a framework where each test asks for a specific driver, and the framework takes care of allocating the proper devices required and passing the correct command line arguments to QEMU.

A node can be of four types:
- MACHINE: for example "arm/raspi2"
- DRIVER: for example "generic-sdhci"
- INTERFACE: for example "sdhci" (interface for all "-sdhci" drivers)
- TEST: for example "sdhci-test", consumes an interface and tests
the functions provided

An edge relation between two nodes (drivers or machines) X and Y can be:
- X CONSUMES Y: Y can be plugged into X
- X PRODUCES Y: X provides the interface Y
- X CONTAINS Y: Y is part of X component

Basic framework steps are the following:
- All nodes and edges are created in their respective machine/driver/test files
- The framework starts QEMU and asks for a list of available devices and machines
- The framework walks the graph starting from the available machines and performs a Depth First Search for tests
- Once a test is found, the path is walked again and all drivers are allocated accordingly and the final interface is passed to the test
- The test is executed
- Unused objects are cleaned and the path discovery is continued

Quoted 7 lines

Depending on the QEMU binary used, only some drivers/machines will be available and only test that are reached by them will be executed.

This work is being done as Google Summer of Code 2018 project for QEMU, my mentors are Paolo Bonzini and Laurent Vivier.
Additional infos on the project can be found at:
https://wiki.qemu.org/Features/qtest_driver_framework

Quoted 7 lines

You've likely answered this question somewhere already, but it should be answered right here: what does this framework buy us?

I figure the main benefit is running tests in all possible contexts, with automated context setup. Instead, you feed the framework declarations of how things are related (the graph stuff described above).

You're right, that is the main benefit: running tests in all possible contexts, with automated context setup.
Before, tests where basically hard-coded to run on a single architecture, or even a single machine type.
Now, qgraph allows this kind of higher level view of the devices and their relationships, where tests generally consume an interface that hides the underneath implementation (for example, for sdhci-pci device, it consumes a "pci-bus", without knowing that the bus can be a pci-pc or pci-spapr).

This allows developers to add test without knowing or forcing the machine/architecture/additional required devices, they just need to know what interface the test can consume (and if not present, implement a node representing the device they want to test). For example, if you look at virtio-9p-test, you can see that the old test was just testing "virtio-9p-pci", while using the qgraph I was able to add "virtio-9p-device" too, without any additional change to the test, improving test coverage.

The other benefit is the automated context setup: as Paolo said once, every test basically re-invented the wheel in its own way. Every test had a main function, a section where qemu was started with proper devices, and a section where everything was cleaned up and shut down. Qgraph handles all these operations automatically, so the developer does not need to care about that. Just add the test function to the graph, and it will take care of running the test with the proper setup.

Of course this requires a minimal knowledge of the graph and the relationships you are going to use, since each test will receive structures representing device from the other nodes in the graph.

Quoted 3 lines

Taking a step back: your cover letter describes a solution at a high level. That's good. But it should *first* describe the problem you're trying to solve.

Do you think this explanation of the problem is fine?

I am not very experienced with patches, so in case it is, should I re-write the cover letter adding the above explanations or is fine like this? In case I should do it, should I submit the whole series again?

Quoted 4 lines
Quoted 4 lines

v3:
- Minor fixes regarding memory leaks and naming