From nobody Wed Nov 5 10:45:08 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 1534156701210544.1955993714269; Mon, 13 Aug 2018 03:38:21 -0700 (PDT) Received: from localhost ([::1]:38682 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fpAEu-0003Lg-2X for importer@patchew.org; Mon, 13 Aug 2018 06:38:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fp9tE-0007f9-5F for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fp9tA-0002id-Uz for qemu-devel@nongnu.org; Mon, 13 Aug 2018 06:15:56 -0400 Received: from mail-ed1-x536.google.com ([2a00:1450:4864:20::536]:41602) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fp9tA-0002hy-L3; Mon, 13 Aug 2018 06:15:52 -0400 Received: by mail-ed1-x536.google.com with SMTP id s24-v6so7940268edr.8; Mon, 13 Aug 2018 03:15:52 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Aug 2018 03:15:50 -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=vokNaUiF/dK24D6ifGoqUuz/g09k3n0IMDJKDFZpbMQ=; b=nx56bxV66MKrnFBEf1e0pKQQ4Evj+ym+u4GDjwVN9KELjvEyeW8nSzA0QGw5Ba30m/ URCAupjLNG0OJ5cKfaLlm5pDa2w89lWVEpw+DqRF1iLzkxXqmAbrKLxMfzdz7vZE2d0F 1ZW1nKfrpZB41cLUfYWjkUPciZyC7vrO2LZOOd8S4JlL8o/GJAY0LaNHDmTf5F6FmL21 JXcRLeKcpKSmnrRfHkQMfRjABeU6501LHsC9a91XfLaFpxIEuAFKdYSYza0XldwpAH9Z xz+JER7wzvAEtcfqulWN6pW0CsrLlm185HKoD2ApsIkmGyb8ZBix+xxGoGXCkAsmcENU sp8Q== 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=vokNaUiF/dK24D6ifGoqUuz/g09k3n0IMDJKDFZpbMQ=; b=tgv2Tv0V2QGZrC2UmgGpGZDNktAvs7KaFnIS0lJN9YcfT3FlDGaaTMaRb5k79+sQuj wDidbfe35edndG2bBG4KEql34GJwsF6Z/ANS32JdJUz3i3ChWzNR2r3foN/gMQcvfZpk IF3+HMZvTCzDU9ZsWMLQLkdCMHB90PJkAuU1epgrkFvUZDqGTsoYAYh70uzW5vOmBPow jpbpCjzDGfQkEu+4rAdGp6quaE/1U/Epao+WcsQLM2ZVNUkGTxA0ECVGxPaCaeruJB6Z fvWekx922G5ftXiOcVieRt+34c1bS0lPHrb5xkjL5y/5ccnV2n+px6jqQfvkuv3zXgh6 fBqA== X-Gm-Message-State: AOUpUlGmKX/SCnje5MS+JX5/IWOHgPryd7gyCmz1Mx7eCCeFPDW0rIqQ R97NXK9licDV5YdmiZ8QGa2mrAiNbmM= X-Google-Smtp-Source: AA+uWPx16jrM9yKjN/SEV6yePiE+6DELowXsUTR9WyexbRRincNdZOJSpdHOsyUpNJZN0mFCRs2Cqw== X-Received: by 2002:a50:fd0f:: with SMTP id i15-v6mr22570480eds.83.1534155351291; Mon, 13 Aug 2018 03:15:51 -0700 (PDT) From: Emanuele Giuseppe Esposito To: qemu-devel@nongnu.org Date: Mon, 13 Aug 2018 12:14:37 +0200 Message-Id: <20180813101453.10200-18-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::536 Subject: [Qemu-devel] [PATCH 17/33] 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: Laurent Vivier , Fam Zheng , qemu-block@nongnu.org, "Michael S. Tsirkin" , Jason Wang , Amit Shah , 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" From: Paolo Bonzini 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 | 121 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 3 deletions(-) create mode 100644 tests/virtio-ccw-test.c diff --git a/tests/Makefile.include b/tests/Makefile.include index 20cb983ed0..0e0bebf783 100644 --- a/tests/Makefile.include +++ b/tests/Makefile.include @@ -397,9 +397,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) @@ -824,6 +822,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..88602f3235 --- /dev/null +++ b/tests/virtio-ccw-test.c @@ -0,0 +1,121 @@ +/* + * 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