From nobody Tue Nov 4 22:03:33 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 1533566474175454.83818295462424; Mon, 6 Aug 2018 07:41:14 -0700 (PDT) Received: from localhost ([::1]:34387 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmgh6-0001RY-VY for importer@patchew.org; Mon, 06 Aug 2018 10:41:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35756) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmgb9-00058Y-Iq for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmgb8-0000xf-EC for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:03 -0400 Received: from mail-ed1-x542.google.com ([2a00:1450:4864:20::542]:37419) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmgb8-0000xF-3u for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:02 -0400 Received: by mail-ed1-x542.google.com with SMTP id b10-v6so5256955eds.4 for ; Mon, 06 Aug 2018 07:35:01 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.126]) by smtp.gmail.com with ESMTPSA id x13-v6sm14615157edx.17.2018.08.06.07.35.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 07:35:00 -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=RcbixgBrFtseNTi9J2c6lY3w/bjgq3eXsSFn40/8wLM=; b=oCarVDpUTX2wp2uwsbpxnL0ktnOxnO6AK61QrkmCblxIBRW+o/dC3EyN8Pg8SIu4eY /J2ZOfJhjBdy07ioOHjuCKefho6PSsIT0aq06DuiowZNwC7JSfMnPdgiBKtaOLbbU2B0 47YYAiD19lxJeI4PcGRUmz0QaMlVkJ7s9OYqgzzyzMwW64ndplu/NU0kp2EbRva3/Kdv 5LUCOMXV25RfGk2uDXzCwjNqia/xYiknLvLe1Xq+bkZnA1srRhWas7s69iUxs1Pljo0t jtr9BPhz/LdGBrXy411OIVA3nq8NzWWGshnKjQajotVQ6A3p36F2NtgMAt1OcL5hCmWp MOGw== 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=RcbixgBrFtseNTi9J2c6lY3w/bjgq3eXsSFn40/8wLM=; b=XZn1neiYFZv2klyzC3tz5j+O33YM6F3JXYtHfPNXsxbQcKmZ4r5aJtGpS7uh2vdaqn o672GtPzaZFIpYygywRY1MadKWAR+XmcF01ecBo10ucIyTXrjlLJrgWsssvZI/EBMzPD f2/h6dwtB3F4Pw43ErlklgcpSG002zVgNIbbgi0or+tnaIL73Xj1OOIZIUqjH7zs+Ciz KUZyoQ/E/ruQlHmjRimjezKk7V4xKuHsW11At1/OUT9836F+REF4HhjHnlam4BtlsUi8 OwshP3p0ELvRU2XRZSmNa4HYp9YtZWP7kdgA62CKOabK1PO/UmtQXlhaV5W8zBpwc7tV pGUg== X-Gm-Message-State: AOUpUlF6cQpt3wC9/eNEWBu5JbMhCU+qtLaeqg0TLY1z2zaGv7S1OzTA TBixjv7uGt3r3ZfBzaJ68s0= X-Google-Smtp-Source: AAOMgpfi5G98kACIk6dbQ28quocSuAO9joVcXGVT99JJ3PW5jewzveH/e7nYjcJT+W5ltZy89KMMaw== X-Received: by 2002:a50:8406:: with SMTP id 6-v6mr18401682edp.97.1533566101084; Mon, 06 Aug 2018 07:35:01 -0700 (PDT) From: Emanuele Giuseppe Esposito To: Paolo Bonzini Date: Mon, 6 Aug 2018 16:33:58 +0200 Message-Id: <20180806143412.27722-21-e.emanuelegiuseppe@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180806143412.27722-1-e.emanuelegiuseppe@gmail.com> References: <20180806143412.27722-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 v2 20/34] test/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 , Stefan Hajnoczi , Emanuele Giuseppe Esposito , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , qemu-devel@nongnu.org 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 ad784a3e84..6742f97058 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 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 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..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" =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 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(virtio_console_test); --=20 2.17.1