From nobody Sun Nov 9 22:30:05 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.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 209.51.188.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 (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1551982645807861.4725587494632; Thu, 7 Mar 2019 10:17:25 -0800 (PST) Received: from localhost ([127.0.0.1]:56770 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1xa6-0000DN-KJ for importer@patchew.org; Thu, 07 Mar 2019 13:17:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h1wqv-0003MT-QP for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h1wqt-0008DM-Un for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:41 -0500 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:36302) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1h1wqr-0008Ao-Ri for qemu-devel@nongnu.org; Thu, 07 Mar 2019 12:30:39 -0500 Received: by mail-wm1-x333.google.com with SMTP id j125so10118377wmj.1 for ; Thu, 07 Mar 2019 09:30:37 -0800 (PST) Received: from 640k.localdomain ([93.56.166.5]) by smtp.gmail.com with ESMTPSA id d206sm9979753wmc.11.2019.03.07.09.30.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Mar 2019 09:30:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=Tm/ryd33j6WKUW5QJW8/39A1xu+xmxtmcNmdEPrlvog=; b=jyPvtRnTf+BIrQcdjcmEizrDMp78VyOXs1mxq7U1OZ+wIGzeKcLRao0a5RtyqZ8S/u GivCnhriDt1VMvTcsF1rlB2HCq4WnU0Bafj/DP/MAZ98Uz/A2tlCmlDbVT2yNZp1iwmJ s6EanqzNjA1Sv5/kGByyvUfKSsJPgHqV/Qx44rjXKHT7CLbDLUO3+IZ5ebm5UMYo4pJT pXyKQ2X8T0zDbudgTz2PhpPQcMRexK+F4qkGij9ZD4i8WVLfoFbAgoecAayk0iDNDZvy IqxWMuHblUNBRI6wnKlaTZATZrZPQxgXGDy6ozggkhF2WACmWmLBtwIy1e25L4/bHQdI gYPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=Tm/ryd33j6WKUW5QJW8/39A1xu+xmxtmcNmdEPrlvog=; b=emGpHD88uY7k0ZezrJ7p/dNiPtW/OMLL7ELyJtdu0D7oFMAnlSkN0p6GTgAR6UviaV AUAnN1yTYdnJbz0jfXLI4m83PxVgzcVUYQJ/OwJc9McxlBb1BGyaSWTPGn8zVDwgoeiO 2N9ZWGmDtVFX+zQSB37WCJdSE0aut47HjlKiskLo55nfW2KeUzk4+dsM3Mdf4NAFWGUu gHX7+te8Zw9FY1S/QFN+uZtNX7FbLnaggYRzqB8TgihWds0QGH5avYd2O+eChdvxpYew zDFeY4yYODXb3wZqwcRh9GLwK6+2iMFf4rj8KAzOWwMZeuMSXPxfdDLNFsz95cq6RoMo hJKw== X-Gm-Message-State: APjAAAWwCOyywO96J5RchkFVkaZILfeVYYI1gZ3fWZf26qrnJZQCDF+d LM1VIfLJSuxNWnG/WQX3B45kh5Fy X-Google-Smtp-Source: APXvYqy/XjH0n38jsolYlidMGmxBKyjZcNMO2MaNAQdeZJmcZZzEWZ0hPhNFtkJ48WWCI0VW3qFZbA== X-Received: by 2002:a1c:4c08:: with SMTP id z8mr5839059wmf.99.1551979835885; Thu, 07 Mar 2019 09:30:35 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 7 Mar 2019 18:29:34 +0100 Message-Id: <1551979804-6060-28-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> References: <1551979804-6060-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::333 Subject: [Qemu-devel] [PULL 27/57] 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: thuth@redhat.com, Emanuele Giuseppe Esposito , lviver@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) 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 | 18 +++++++----------- tests/libqos/virtio.c | 1 + tests/virtio-console-test.c | 38 -------------------------------------- tests/virtio-serial-test.c | 27 ++++++++++++--------------- 4 files changed, 20 insertions(+), 64 deletions(-) delete mode 100644 tests/virtio-console-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 2a51cab..d0cd6d2 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -153,18 +153,14 @@ check-qtest-generic-y +=3D tests/cdrom-test$(EXESUF) =20 check-qtest-ipack-y +=3D tests/ipoctal232-test$(EXESUF) =20 -check-qtest-virtioserial-$(CONFIG_VIRTIO_SERIAL) +=3D tests/virtio-console= -test$(EXESUF) - -check-qtest-virtio-$(CONFIG_VIRTIO_NET) +=3D tests/virtio-net-test$(EXESUF) -check-qtest-virtio-$(CONFIG_VIRTIO_BALLOON) +=3D tests/virtio-balloon-test= $(EXESUF) -check-qtest-virtio-$(CONFIG_VIRTIO_BLK) +=3D tests/virtio-blk-test$(EXESUF) -check-qtest-virtio-$(CONFIG_VIRTIO_RNG) +=3D tests/virtio-rng-test$(EXESUF) -check-qtest-virtio-$(CONFIG_VIRTIO_SCSI) +=3D tests/virtio-scsi-test$(EXES= UF) +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) +check-qtest-virtio-y +=3D tests/virtio-rng-test$(EXESUF) +check-qtest-virtio-y +=3D tests/virtio-scsi-test$(EXESUF) ifeq ($(CONFIG_VIRTIO)$(CONFIG_VIRTFS)$(CONFIG_PCI),yyy) check-qtest-virtio-$(CONFIG_VIRTIO_9P) +=3D tests/virtio-9p-test$(EXESUF) endif -check-qtest-virtio-$(CONFIG_VIRTIO_SERIAL) +=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) @@ -315,6 +311,7 @@ check-qtest-s390x-$(CONFIG_POSIX) +=3D tests/test-filte= r-redirector$(EXESUF) check-qtest-s390x-y +=3D tests/drive_del-test$(EXESUF) check-qtest-s390x-y +=3D tests/device-plug-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 @@ -768,6 +765,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) @@ -820,8 +818,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