qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Laurent Vivier" <lvivier@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	qemu-devel@nongnu.org, "Stefan Hajnoczi" <stefanha@gmail.com>,
	"Emanuele Giuseppe Esposito" <e.emanuelegiuseppe@gmail.com>
Subject: [Qemu-devel] [PATCH v2 20/34] test/qgraph: virtio-console test node
Date: Mon,  6 Aug 2018 16:33:58 +0200	[thread overview]
Message-ID: <20180806143412.27722-21-e.emanuelegiuseppe@gmail.com> (raw)
In-Reply-To: <20180806143412.27722-1-e.emanuelegiuseppe@gmail.com>

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

Signed-off-by: Emanuele Giuseppe Esposito <e.emanuelegiuseppe@gmail.com>
---
 tests/Makefile.include      |  5 +++--
 tests/libqos/virtio.c       |  1 +
 tests/virtio-console-test.c | 30 +++++++++++++++---------------
 3 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/tests/Makefile.include b/tests/Makefile.include
index ad784a3e84..6742f97058 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -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
diff --git a/tests/libqos/virtio.c b/tests/libqos/virtio.c
index 56007ef11b..9b97ab0625 100644
--- a/tests/libqos/virtio.c
+++ b/tests/libqos/virtio.c
@@ -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)
 {
diff --git a/tests/virtio-console-test.c b/tests/virtio-console-test.c
index 945bae5a15..55d5c0f138 100644
--- a/tests/virtio-console-test.c
+++ b/tests/virtio-console-test.c
@@ -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 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(virtio_console_test);
-- 
2.17.1

  parent reply	other threads:[~2018-08-06 14:35 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-06 14:33 [Qemu-devel] [PATCH v2 00/34] Qtest driver framework Emanuele Giuseppe Esposito
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 01/34] tests: qgraph API for the qtest " Emanuele Giuseppe Esposito
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 02/34] tests/qgraph: rename qpci_init_pc functions Emanuele Giuseppe Esposito
2018-08-06 15:04   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 03/34] tests/qgraph: pci-pc driver and interface nodes Emanuele Giuseppe Esposito
2018-08-08 17:39   ` Laurent Vivier
2018-08-09 12:17     ` Emanuele
2018-08-09 12:29       ` Laurent Vivier
2018-08-09 12:33         ` Emanuele
2018-08-09 12:42           ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 04/34] tests/qgraph: x86_64/pc machine node Emanuele Giuseppe Esposito
2018-08-08 19:27   ` Laurent Vivier
2018-08-09 12:23     ` Emanuele
2018-08-09 12:32       ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 05/34] tests/qgraph: sdhci driver and interface nodes Emanuele Giuseppe Esposito
2018-08-09 10:10   ` Laurent Vivier
2018-08-09 10:15     ` Paolo Bonzini
2018-08-09 11:01       ` Laurent Vivier
2018-08-10 10:16         ` Paolo Bonzini
2018-08-09 13:27     ` Emanuele
2018-08-09 13:58       ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 06/34] tests/qgraph: sdhci test node Emanuele Giuseppe Esposito
2018-08-09 11:16   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 07/34] tests/qgraph: arm/raspi2 machine node Emanuele Giuseppe Esposito
2018-08-09 12:35   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 08/34] tests/qgraph: rename qpci_init_spapr functions Emanuele Giuseppe Esposito
2018-08-08 15:30   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 09/34] tests/qgraph: pci-spapr driver and interface nodes Emanuele Giuseppe Esposito
2018-08-09 12:57   ` Laurent Vivier
2018-08-09 13:02   ` Laurent Vivier
2018-08-09 13:19     ` Emanuele
2018-08-10  7:14       ` Paolo Bonzini
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 10/34] tests/qgraph: ppc64/pseries machine node Emanuele Giuseppe Esposito
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 11/34] test/qgraph: e1000e driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 12/34] test/qgraph: e1000e-test node Emanuele Giuseppe Esposito
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 13/34] test/qgraph: virtio_start_device function Emanuele Giuseppe Esposito
2018-08-09 13:39   ` Laurent Vivier
2018-08-09 15:00     ` Emanuele
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 14/34] test/qgraph: virtio-pci driver and interface nodes Emanuele Giuseppe Esposito
2018-08-09 14:08   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 15/34] tests/qgraph: rename qvirtio_mmio_init_device functions Emanuele Giuseppe Esposito
2018-08-09 14:13   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 16/34] test/qgraph: virtio-mmio driver and interface nodes Emanuele Giuseppe Esposito
2018-08-09 14:47   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 17/34] test/qgraph: arm/virt machine node Emanuele Giuseppe Esposito
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 18/34] tests: virtio: separate ccw tests from libqos Emanuele Giuseppe Esposito
2018-08-08 19:34   ` Laurent Vivier
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 19/34] test/qgraph: virtio-serial driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:33 ` Emanuele Giuseppe Esposito [this message]
2018-08-06 14:33 ` [Qemu-devel] [PATCH v2 21/34] test/qgraph: virtio-serial test node Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 22/34] test/qgraph: virtio-9p driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 23/34] test/qgraph: virtio-9p test node Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 24/34] test/qgraph: virtio-balloon driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 25/34] test/qgraph: virtio-balloon test node Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 26/34] test/qgraph: virtio-rng driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 27/34] test/qgraph: virtio-rng test node Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 28/34] test/qgraph: virtio-blk driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 29/34] test/qgraph: virtio-blk test node Emanuele Giuseppe Esposito
2018-08-09 14:16   ` Laurent Vivier
2018-08-10  9:45     ` Emanuele
2018-08-10  9:52       ` Laurent Vivier
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 30/34] test/qgraph: virtio-net driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 31/34] test/qgraph: virtio-net test node Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 32/34] test/qgraph: virtio-scsi driver and interface nodes Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 33/34] test/qgraph: virtio-scsi test node Emanuele Giuseppe Esposito
2018-08-06 14:34 ` [Qemu-devel] [PATCH v2 34/34] test/qgraph: temporarly commented vhost-user-test Emanuele Giuseppe Esposito
2018-08-09  8:57 ` [Qemu-devel] [PATCH v2 00/34] Qtest driver framework Paolo Bonzini
2018-08-09  9:20   ` Emanuele
2018-08-09  9:44     ` Paolo Bonzini
2018-08-09 10:27       ` Emanuele
2018-08-10 10:40       ` Emanuele

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180806143412.27722-21-e.emanuelegiuseppe@gmail.com \
    --to=e.emanuelegiuseppe@gmail.com \
    --cc=f4bug@amsat.org \
    --cc=lvivier@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).