From nobody Mon Feb 9 16:53:59 2026 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; 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=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1543853480454915.267574415116; Mon, 3 Dec 2018 08:11:20 -0800 (PST) Received: from localhost ([::1]:50363 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTqoS-0002xR-27 for importer@patchew.org; Mon, 03 Dec 2018 11:11:12 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52174) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gTqF7-0000rq-1j for qemu-devel@nongnu.org; Mon, 03 Dec 2018 10:34:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gTqF2-00058h-57 for qemu-devel@nongnu.org; Mon, 03 Dec 2018 10:34:41 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49972) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gTqF1-00057v-TP for qemu-devel@nongnu.org; Mon, 03 Dec 2018 10:34:36 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42F16C049D4B; Mon, 3 Dec 2018 15:34:35 +0000 (UTC) Received: from 640k.localdomain.com (ovpn-112-19.ams2.redhat.com [10.36.112.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id 02FA618A50; Mon, 3 Dec 2018 15:34:33 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Mon, 3 Dec 2018 16:32:54 +0100 Message-Id: <1543851204-41186-42-git-send-email-pbonzini@redhat.com> In-Reply-To: <1543851204-41186-1-git-send-email-pbonzini@redhat.com> References: <1543851204-41186-1-git-send-email-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 03 Dec 2018 15:34:35 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 41/71] qos-test: virtio-console and virtio-serial 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: Thomas Huth , Emanuele Giuseppe Esposito , Laurent Vivier Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Emanuele Giuseppe Esposito Convert tests/virtio-console-test and tests/virtio-serial-test in qgraph test node. 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 or virtio-serial structure, it's all done by the qtest walking graph mechanism Signed-off-by: Emanuele Giuseppe Esposito Signed-off-by: Paolo Bonzini --- tests/Makefile.include | 8 ++------ tests/libqos/virtio.c | 1 + tests/virtio-console-test.c | 38 -------------------------------------- tests/virtio-serial-test.c | 27 ++++++++++++--------------- 4 files changed, 15 insertions(+), 59 deletions(-) delete mode 100644 tests/virtio-console-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 58f548d..88821a7 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -143,8 +143,6 @@ check-qtest-generic-y +=3D tests/cdrom-test$(EXESUF) =20 check-qtest-ipack-y +=3D tests/ipoctal232-test$(EXESUF) =20 -check-qtest-virtioserial-y +=3D tests/virtio-console-test$(EXESUF) - check-qtest-virtio-y +=3D tests/virtio-net-test$(EXESUF) check-qtest-virtio-y +=3D tests/virtio-balloon-test$(EXESUF) check-qtest-virtio-y +=3D tests/virtio-blk-test$(EXESUF) @@ -153,8 +151,6 @@ check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESU= F) ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) check-qtest-virtio-y +=3D tests/virtio-9p-test$(EXESUF) endif -check-qtest-virtio-y +=3D tests/virtio-serial-test$(EXESUF) -check-qtest-virtio-y +=3D $(check-qtest-virtioserial-y) =20 check-qtest-pci-y +=3D tests/e1000-test$(EXESUF) check-qtest-pci-$(CONFIG_RTL8139_PCI) +=3D tests/rtl8139-test$(EXESUF) @@ -293,6 +289,7 @@ 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/cpu-plug-test$(EXESUF) check-qtest-s390x-y +=3D tests/migration-test$(EXESUF) =20 @@ -694,6 +691,7 @@ qos-test-obj-y +=3D tests/e1000e-test.o qos-test-obj-y +=3D tests/pci-test.o qos-test-obj-y +=3D tests/sdhci-test.o qos-test-obj-y +=3D tests/virtio-test.o +qos-test-obj-y +=3D tests/virtio-serial-test.o =20 check-unit-y +=3D tests/test-qgraph$(EXESUF) tests/test-qgraph$(EXESUF): tests/test-qgraph.o $(libqgraph-obj-y) @@ -745,8 +743,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-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 5a62950..9fc8c7e 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 deleted file mode 100644 index a7c6f16..0000000 --- a/tests/virtio-console-test.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * QTest testcase for VirtIO Console - * - * Copyright (c) 2014 SUSE LINUX Products GmbH - * - * This work is licensed under the terms of the GNU GPL, version 2 or late= r. - * See the COPYING file in the top-level directory. - */ - -#include "qemu/osdep.h" -#include "libqtest.h" -#include "libqos/virtio.h" - -/* Tests only initialization so far. TODO: Replace with functional tests */ -static void console_nop(void) -{ - global_qtest =3D qtest_initf("-device virtio-serial-%s,id=3Dvser0 " - "-device virtconsole,bus=3Dvser0.0", - qvirtio_get_dev_type()); - qtest_end(); -} - -static void serialport_nop(void) -{ - global_qtest =3D qtest_initf("-device virtio-serial-%s,id=3Dvser0 " - "-device virtserialport,bus=3Dvser0.0", - qvirtio_get_dev_type()); - qtest_end(); -} - -int main(int argc, char **argv) -{ - g_test_init(&argc, &argv, NULL); - qtest_add_func("/virtio/console/nop", console_nop); - qtest_add_func("/virtio/serialport/nop", serialport_nop); - - return g_test_run(); -} diff --git a/tests/virtio-serial-test.c b/tests/virtio-serial-test.c index 8da9980..85f35e0 100644 --- a/tests/virtio-serial-test.c +++ b/tests/virtio-serial-test.c @@ -9,33 +9,30 @@ =20 #include "qemu/osdep.h" #include "libqtest.h" -#include "libqos/virtio.h" +#include "libqos/virtio-serial.h" =20 /* 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 *allo= c) { + /* no operation */ } =20 -static void hotplug(void) +static void serial_hotplug(void *obj, void *data, QGuestAllocator *alloc) { qtest_qmp_device_add("virtserialport", "hp-port", "{}"); - qtest_qmp_device_del("hp-port"); } =20 -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); + QOSGraphTestOptions opts =3D { }; =20 - global_qtest =3D qtest_initf("-device virtio-serial-%s", - qvirtio_get_dev_type()); - ret =3D g_test_run(); + opts.edge.before_cmd_line =3D "-device virtconsole,bus=3Dvser0.0"; + qos_add_test("console-nop", "virtio-serial", virtio_serial_nop, &opts); =20 - qtest_end(); + opts.edge.before_cmd_line =3D "-device virtserialport,bus=3Dvser0.0"; + qos_add_test("serialport-nop", "virtio-serial", virtio_serial_nop, &op= ts); =20 - return ret; + qos_add_test("hotplug", "virtio-serial", serial_hotplug, NULL); } +libqos_init(register_virtio_serial_test); --=20 1.8.3.1