From nobody Wed Nov 5 10:45:07 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1534155995500802.0123245950443; Mon, 13 Aug 2018 03:26:35 -0700 (PDT) Received: from localhost ([::1]:38567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpA3Q-0000Z7-Bt for importer@patchew.org; Mon, 13 Aug 2018 06:26:28 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44060) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp9tH-0007ht-S6 for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:16:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp9tG-0002lO-Q0 for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:59 -0400 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]:40939) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fp9tG-0002l7-Fm; Mon, 13 Aug 2018 06:15:58 -0400 Received: by mail-ed1-x542.google.com with SMTP id e19-v6so7945925edq.7; Mon, 13 Aug 2018 03:15:58 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.125]) by smtp.gmail.com with ESMTPSA id s27-v6sm11670006edb.73.2018.08.13.03.15.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 03:15:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RHkVOb5l3mhj1ib8lxU4WEJVMz4Iepa4sl0VXVdvBPg=; b=vS/P7B6PF8JHo7o8LlS17NYON3fgv+6jt+igYsMjYZvqiJRMf0oI4OXzM8MJDpasNz D04vFGlCdGlWCP0vjvTM3bYysDRA2nhrIBKdmgNYlH/KTUhcu7ipffR5vjC+XkLWk6mF 6ZTDkwDpiSPeJnf0TaVddy8whGVvAc6zGL7E8bi0FXB9l37qF33LtERifxSLP1EhQdIh AlEiyAX4sEAZiwfpUOHWEl0DhPmR/JCYkTc0bpwTN1Xv7dKiejxl0h4DvQgUA0uJRsoZ 5YmRSxYKqrQO7v0u8vC64VpsLNPu2dHm0UhYcwli06oPHuWfOg2OM+cEocf700E8DsHg yCwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RHkVOb5l3mhj1ib8lxU4WEJVMz4Iepa4sl0VXVdvBPg=; b=lHose1aqqYYAPThSmBa2D9Yc/DnLChUeTK20kf5MSVBic7AcDV+MbQgRCNVjDHPXXq yiL8gP7+jNkc45FJEXtOEWhF69lBu2J4ci2MjJSjaU4CRnsbPiA/J1eYSxouJeeh/7E1 +VeKlJcCvz9ugQ0lXZVga50kiZCjQ0XMoI0iq+1IXyl3/WBQ1T2h9pjcYHYBy+182rvB h1TKDmaNhXxkdbqYMiz51h933MuY9K3l0JDeEdeDXgdAp2Z63tNcMRmS+/wrk9GGKYyX YrHg6PW9mItK8pFOsY6zAN2XvM+AYIvbbP+DqqPzHHigJ2K70SuIOuKCT+6amwOUNZTf Yq2Q== X-Gm-Message-State: AOUpUlGQJsxtbbQjeRGTIZL9tXYVUVOuJSLGZGsyZpg0pY5SCcdjnGqo 2NH8AC0dzY0qwW5UDyQlNvrqUzuqOCQ= X-Google-Smtp-Source: AA+uWPzoIX+JUJBi0x1vhkC1zw5TAxFi6vMpRYqmKwBObGgNo/vS3N7TfUdY30+O9fu/4LcnneaPYA== X-Received: by 2002:a50:ade6:: with SMTP id b35-v6mr21593863edd.168.1534155357172; Mon, 13 Aug 2018 03:15:57 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 12:14:39 +0200 Message-Id: <20180813101453.10200-20-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> References: <20180813101453.10200-1-e.emanuelegiuseppe@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::542 Subject: [Qemu-devel] [PATCH 19/33] tests/qgraph: virtio-console test node X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Laurent Vivier , Fam Zheng , qemu-block@nongnu.org, "Michael S. Tsirkin" , Jason Wang , Amit Shah , Emanuele Giuseppe Esposito , Alexander Graf , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Greg Kurz , qemu-ppc@nongnu.org, Gerd Hoffmann , Stefan Hajnoczi , Paolo Bonzini , John Snow , David Gibson Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" 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 --- 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 409475eafd..a160059758 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -187,7 +187,6 @@ gcov-files-ipack-y +=3D hw/ipack/ipack.c check-qtest-ipack-y +=3D tests/ipoctal232-test$(EXESUF) gcov-files-ipack-y +=3D hw/char/ipoctal232.c =20 -check-qtest-virtioserial-y +=3D tests/virtio-console-test$(EXESUF) gcov-files-virtioserial-y +=3D hw/char/virtio-console.c =20 gcov-files-virtio-y +=3D i386-softmmu/hw/virtio/virtio.c @@ -398,6 +397,8 @@ check-qtest-s390x-$(CONFIG_POSIX) +=3D tests/test-filte= r-mirror$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) +=3D tests/test-filter-redirector$(EXESU= F) check-qtest-s390x-y +=3D tests/drive_del-test$(EXESUF) check-qtest-s390x-y +=3D tests/virtio-ccw-test$(EXESUF) +check-qtest-s390x-y +=3D tests/virtio-balloon-test$(EXESUF) +check-qtest-s390x-y +=3D tests/virtio-serial-test$(EXESUF) check-qtest-s390x-y +=3D tests/cpu-plug-test$(EXESUF) =20 check-qtest-generic-y +=3D tests/machine-none-test$(EXESUF) @@ -781,6 +782,7 @@ libqgraph-pci-obj-y +=3D tests/libqos/e1000e.o libqgraph-tests-obj-y =3D $(libqgraph-pci-obj-y) libqgraph-tests-obj-y +=3D tests/sdhci-test.o libqgraph-tests-obj-y +=3D tests/e1000e-test.o +libqgraph-tests-obj-y +=3D tests/virtio-console-test.o =20 check-unit-y +=3D 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-vir= tio-obj-y) -tests/virtio-console-test$(EXESUF): tests/virtio-console-test.o $(libqos-v= irtio-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 c1ff0206d5..6c2124523e 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 architect= ure. + * 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..336078f1c0 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" =20 /* 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 =3D qtest_startf("-device virtio-serial-%s,id=3Dvser0 " - "-device virtconsole,bus=3Dvser0.0", - qvirtio_get_dev_type()); - qtest_end(); + /* no operation */ } =20 -static void serialport_nop(void) +static void serialport_nop(void *obj, void *data, QGuestAllocator *alloc) { - global_qtest =3D qtest_startf("-device virtio-serial-%s,id=3Dvser0 " - "-device virtserialport,bus=3Dvser0.0", - qvirtio_get_dev_type()); - qtest_end(); + /* no operation */ } =20 -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 =3D { }; + QOSGraphEdgeOptions *edge_opts =3D &opts.edge; =20 - return g_test_run(); + edge_opts->before_cmd_line =3D "-device virtconsole,bus=3Dvser0.0"; + qos_add_test("console-nop", "virtio-serial", console_nop, &opts); + + edge_opts->before_cmd_line =3D "-device virtserialport,bus=3Dvser0.0"; + qos_add_test("serialport-nop", "virtio-serial", serialport_nop, &opts); } + +libqos_init(register_virtio_console_test); --=20 2.17.1