From nobody Tue Nov 4 22:00:43 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 1533567291131489.56209179996904; Mon, 6 Aug 2018 07:54:51 -0700 (PDT) Received: from localhost ([::1]:34454 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmguI-0005Le-1f for importer@patchew.org; Mon, 06 Aug 2018 10:54:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35732) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fmgb7-00055p-A4 for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fmgb6-0000wa-3N for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:01 -0400 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:32938) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fmgb5-0000wH-OV for qemu-devel@nongnu.org; Mon, 06 Aug 2018 10:35:00 -0400 Received: by mail-ed1-x52e.google.com with SMTP id x5-v6so5274490edr.0 for ; Mon, 06 Aug 2018 07:34:59 -0700 (PDT) Received: from localhost.localdomain ([194.230.159.126]) by smtp.gmail.com with ESMTPSA id x13-v6sm14615157edx.17.2018.08.06.07.34.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Aug 2018 07:34:58 -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=WBbIu91Tqr8ZNrDywocj9t369Aw1RRR+lBlwqIqBeQU=; b=bBWIPA2nWB+K6aK41p0MdQ0HDPBVDfyzQY0+6NpT7hrZX1ueEdTn4X+Kf6W47pQhRk EwZhtF8rQH43K/+K7T8m0RER7mdKWS/ZvbAvRNRWQwQPybqOiFX+euvdZYLGGou5fDM9 Hnv0b6CZgW/LDYeoGVJC2dZ/EFSwicUAIIH/fUyob9FeLSN8lF/CJysqYVjLTBl4i5yk EyEjfMwJNcEha/XpdKqUelwAGm54JGJqTUEVKLxfOGrLmJfp7IESdlvsaygSMwZlO6g7 eqv5bnqzESkjfuRllq3F3cifEKwWsUAbUprWjUoywTqGAG8rHoMPSijGJNRxddg+9Ti3 LyGA== 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=WBbIu91Tqr8ZNrDywocj9t369Aw1RRR+lBlwqIqBeQU=; b=SPcVAnwWVASfiCitqXo3iJ5deUUf7IHqwm9vJUAWldVX8bLubMuaJsQ91ORzhYrR7H AM5EfWKvaqVXxYCbs5fM4r34TL4kgFnVd32eIiwH34yWmjrQlW7p6vac0h7gh0mT44Wl YQ7zHxCw70KQtNGsC9JlIwaTpkdZd2Dpn4aVIRbIE0yTzO0yDOIOodkKG6Yore0zpXfM +QA2qG7kFD+oAj4NkllrY5PpL3A4MK8x8SkzdtiJ0VN/+SutFgqRQuc1fgYPr2TI7w4s Jo2KNH1wXmszd42+z5UZhZroLDwbemp6a2wD3TYp7UmPWK/EVGkTv5UNwlV7DISx6f4a 8Ltg== X-Gm-Message-State: AOUpUlEwLzK3/wLAo4a9/cPPQEs39mvduRwmOdDFSYrAfIcdjPAcXb62 q5zQ+Vlt8fNaFIYdwo7b9BjXrrZt X-Google-Smtp-Source: AAOMgpeuDLAqZ4oGPoMNRCTB4wTsKrxvwLJkpk7m81TciAj0oZ73yg8g5oIbJMkTBngzHAqQhR8oVg== X-Received: by 2002:a50:c251:: with SMTP id t17-v6mr18489454edf.108.1533566098725; Mon, 06 Aug 2018 07:34:58 -0700 (PDT) From: Emanuele Giuseppe Esposito To: Paolo Bonzini Date: Mon, 6 Aug 2018 16:33:56 +0200 Message-Id: <20180806143412.27722-19-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::52e Subject: [Qemu-devel] [PATCH v2 18/34] 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 , 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" 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 Signed-off-by: Emanuele Giuseppe Esposito --- 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 4659785baf..d72d0d65b4 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