From nobody Wed Nov 5 05:21:41 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; 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 (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1533130129266724.7500607039589; Wed, 1 Aug 2018 06:28:49 -0700 (PDT) Received: from localhost ([::1]:40100 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkrBI-0000sA-3m for importer@patchew.org; Wed, 01 Aug 2018 09:28:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fkrAJ-0000Ye-W3 for qemu-devel@nongnu.org; Wed, 01 Aug 2018 09:27:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fkrAG-0005AQ-J5 for qemu-devel@nongnu.org; Wed, 01 Aug 2018 09:27:47 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:59922 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fkrAG-00055a-6k; Wed, 01 Aug 2018 09:27:44 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9A7DF4021CC3; Wed, 1 Aug 2018 13:27:34 +0000 (UTC) Received: from donizetti.redhat.com (ovpn-116-228.ams2.redhat.com [10.36.116.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C714F1C65F; Wed, 1 Aug 2018 13:27:33 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 1 Aug 2018 15:27:33 +0200 Message-Id: <20180801132733.15628-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 01 Aug 2018 13:27:34 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Wed, 01 Aug 2018 13:27:34 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH] tests: virtio: separate ccw tests from libqos 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: qemu-s390x@nongnu.org, e.emanuelegiuseppe@gmail.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Because qtest does not support s390 channel I/O, s390 only performs smoke t= ests on those few devices that do not have any functional tests. Therefore, every = time we add functional tests for a virtio device, the choice is between removing those tests from the s390 suite (so that s390 actually _loses_ coverage) or sprinkling the test with architecture checks. This patch simply creates a ccw-specific test that only performs smoke test= s on all virtio-ccw devices. If channel I/O support is ever added to qtest and = libqos, then this file can go away. In the meanwhile, it simplifies maintenance and makes sure that all virtio devices are tested. Signed-off-by: Paolo Bonzini Acked-by: Cornelia Huck Reviewed-by: Thomas Huth --- tests/Makefile.include | 5 +- tests/virtio-ccw-test.c | 118 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 tests/virtio-ccw-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index a49282704e..cf835f2fd0 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -401,9 +401,7 @@ check-qtest-s390x-$(CONFIG_SLIRP) +=3D tests/test-netfi= lter$(EXESUF) check-qtest-s390x-$(CONFIG_POSIX) +=3D tests/test-filter-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-balloon-test$(EXESUF) -check-qtest-s390x-y +=3D tests/virtio-console-test$(EXESUF) -check-qtest-s390x-y +=3D tests/virtio-serial-test$(EXESUF) +check-qtest-s390x-y +=3D tests/virtio-ccw-test$(EXESUF) check-qtest-s390x-y +=3D tests/cpu-plug-test$(EXESUF) =20 check-qtest-generic-y +=3D tests/machine-none-test$(EXESUF) @@ -807,6 +805,7 @@ tests/wdt_ib700-test$(EXESUF): tests/wdt_ib700-test.o tests/tco-test$(EXESUF): tests/tco-test.o $(libqos-pc-obj-y) tests/virtio-balloon-test$(EXESUF): tests/virtio-balloon-test.o $(libqos-v= irtio-obj-y) tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-ob= j-y) +tests/virtio-ccw-test$(EXESUF): tests/virtio-ccw-test.o tests/virtio-net-test$(EXESUF): tests/virtio-net-test.o $(libqos-pc-obj-y)= $(libqos-virtio-obj-y) 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) diff --git a/tests/virtio-ccw-test.c b/tests/virtio-ccw-test.c new file mode 100644 index 0000000000..0af3a7bb31 --- /dev/null +++ b/tests/virtio-ccw-test.c @@ -0,0 +1,118 @@ +/* + * QTest testcase for VirtIO CCW + * + * Copyright (c) 2014 SUSE LINUX Products GmbH + * Copyright (c) 2018 Red Hat, Inc. + * + * 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. + */ + +/* Until we have a full libqos implementation of virtio-ccw (which requires + * also to add support for I/O channels to qtest), we can only do simple + * tests that initialize the devices. + */ + +#include "qemu/osdep.h" +#include "libqtest.h" +#include "libqos/virtio.h" + +static void virtio_balloon_nop(void) +{ + global_qtest =3D qtest_startf("-device virtio-balloon-ccw"); + qtest_end(); +} + +static void virtconsole_nop(void) +{ + global_qtest =3D qtest_startf("-device virtio-serial-ccw,id=3Dvser0 " + "-device virtconsole,bus=3Dvser0.0"); + qtest_end(); +} + +static void virtserialport_nop(void) +{ + global_qtest =3D qtest_startf("-device virtio-serial-ccw,id=3Dvser0 " + "-device virtserialport,bus=3Dvser0.0"); + qtest_end(); +} + +static void virtio_serial_nop(void) +{ + global_qtest =3D qtest_startf("-device virtio-serial-ccw"); + qtest_end(); +} + +static void virtio_serial_hotplug(void) +{ + global_qtest =3D qtest_startf("-device virtio-serial-ccw"); + qtest_qmp_device_add("virtserialport", "hp-port", NULL); + qtest_qmp_device_del("hp-port"); + qtest_end(); +} + +static void virtio_blk_nop(void) +{ + global_qtest =3D qtest_startf("-drive if=3Dnone,id=3Ddrv0,file=3Dnull-= co://,format=3Draw " + "-device virtio-blk-ccw,drive=3Ddrv0"); + qtest_end(); +} + +static void virtio_net_nop(void) +{ + global_qtest =3D qtest_startf("-device virtio-net-ccw"); + qtest_end(); +} + +static void virtio_9p_nop(void) +{ + global_qtest =3D qtest_startf("-fsdev synth,id=3Dfsdev0 " + "-device virtio-9p-ccw,fsdev=3Dfsdev0,moun= t_tag=3Dqtest"); + qtest_end(); +} + +static void virtio_rng_nop(void) +{ + global_qtest =3D qtest_startf("-device virtio-rng-ccw"); + qtest_end(); +} + +static void virtio_scsi_nop(void) +{ + global_qtest =3D qtest_startf("-device virtio-scsi-ccw"); + qtest_end(); +} + +static void virtio_scsi_hotplug(void) +{ + global_qtest =3D qtest_startf("-drive if=3Dnone,id=3Ddrv0,file=3Dnull-= co://,format=3Draw " + "-drive if=3Dnone,id=3Ddrv1,file=3Dnull-co= ://,format=3Draw " + "-device virtio-scsi-ccw " + "-device scsi-hd,drive=3Ddrv0"); + qtest_qmp_device_add("scsi-hd", "scsihd", "'drive': 'drv1'"); + qtest_qmp_device_del("scsihd"); + + qtest_end(); +} + +int main(int argc, char **argv) +{ + int ret; + + g_test_init(&argc, &argv, NULL); + qtest_add_func("/virtio/balloon/nop", virtio_balloon_nop); + qtest_add_func("/virtio/console/nop", virtconsole_nop); + qtest_add_func("/virtio/serialport/nop", virtserialport_nop); + qtest_add_func("/virtio/serial/nop", virtio_serial_nop); + qtest_add_func("/virtio/serial/hotplug", virtio_serial_hotplug); + qtest_add_func("/virtio/block/nop", virtio_blk_nop); + qtest_add_func("/virtio/net/nop", virtio_net_nop); + qtest_add_func("/virtio/9p/nop", virtio_9p_nop); + qtest_add_func("/virtio/rng/nop", virtio_rng_nop); + qtest_add_func("/virtio/scsi/nop", virtio_scsi_nop); + qtest_add_func("/virtio/scsi/hotplug", virtio_scsi_hotplug); + + ret =3D g_test_run(); + + return ret; +} --=20 2.17.1