[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PATCH 17/33] tests: virtio: separate ccw tests from libqos
From: |
Emanuele Giuseppe Esposito |
Subject: |
[Qemu-block] [PATCH 17/33] tests: virtio: separate ccw tests from libqos |
Date: |
Mon, 13 Aug 2018 12:14:37 +0200 |
From: Paolo Bonzini <address@hidden>
Because qtest does not support s390 channel I/O, s390 only performs smoke tests
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 tests 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 <address@hidden>
Acked-by: Cornelia Huck <address@hidden>
Reviewed-by: Thomas Huth <address@hidden>
---
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) +=
tests/test-netfilter$(EXESUF)
check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-mirror$(EXESUF)
check-qtest-s390x-$(CONFIG_POSIX) += tests/test-filter-redirector$(EXESUF)
check-qtest-s390x-y += tests/drive_del-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-balloon-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-console-test$(EXESUF)
-check-qtest-s390x-y += tests/virtio-serial-test$(EXESUF)
+check-qtest-s390x-y += tests/virtio-ccw-test$(EXESUF)
check-qtest-s390x-y += tests/cpu-plug-test$(EXESUF)
check-qtest-generic-y += 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-virtio-obj-y)
tests/virtio-blk-test$(EXESUF): tests/virtio-blk-test.o $(libqos-virtio-obj-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 later.
+ * 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 = qtest_startf("-device virtio-balloon-ccw");
+ qtest_end();
+}
+
+static void virtconsole_nop(void)
+{
+ global_qtest = qtest_startf("-device virtio-serial-ccw,id=vser0 "
+ "-device virtconsole,bus=vser0.0");
+ qtest_end();
+}
+
+static void virtserialport_nop(void)
+{
+ global_qtest = qtest_startf("-device virtio-serial-ccw,id=vser0 "
+ "-device virtserialport,bus=vser0.0");
+ qtest_end();
+}
+
+static void virtio_serial_nop(void)
+{
+ global_qtest = qtest_startf("-device virtio-serial-ccw");
+ qtest_end();
+}
+
+static void virtio_serial_hotplug(void)
+{
+ global_qtest = 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 = qtest_startf("-drive if=none,id=drv0,"
+ "file=null-co://,format=raw "
+ "-device virtio-blk-ccw,drive=drv0");
+ qtest_end();
+}
+
+static void virtio_net_nop(void)
+{
+ global_qtest = qtest_startf("-device virtio-net-ccw");
+ qtest_end();
+}
+
+static void virtio_9p_nop(void)
+{
+ global_qtest = qtest_startf("-fsdev synth,id=fsdev0 "
+ "-device
virtio-9p-ccw,fsdev=fsdev0,mount_tag=qtest");
+ qtest_end();
+}
+
+static void virtio_rng_nop(void)
+{
+ global_qtest = qtest_startf("-device virtio-rng-ccw");
+ qtest_end();
+}
+
+static void virtio_scsi_nop(void)
+{
+ global_qtest = qtest_startf("-device virtio-scsi-ccw");
+ qtest_end();
+}
+
+static void virtio_scsi_hotplug(void)
+{
+ global_qtest = qtest_startf("-drive if=none,id=drv0,"
+ "file=null-co://,format=raw "
+ "-drive if=none,id=drv1,"
+ "file=null-co://,format=raw "
+ "-device virtio-scsi-ccw "
+ "-device scsi-hd,drive=drv0");
+ 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 = g_test_run();
+
+ return ret;
+}
--
2.17.1
- [Qemu-block] [PATCH 00/33] Qtest driver framework, Emanuele Giuseppe Esposito, 2018/08/13
- Re: [Qemu-block] [PATCH 00/33] Qtest driver framework, Michael S. Tsirkin, 2018/08/13
- [Qemu-block] [PATCH 03/33] tests/qgraph: pci-pc driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 04/33] tests/qgraph: x86_64/pc machine node, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 05/33] tests/qgraph: sdhci driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 17/33] tests: virtio: separate ccw tests from libqos,
Emanuele Giuseppe Esposito <=
- [Qemu-block] [PATCH 23/33] tests/qgraph: virtio-balloon driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 31/33] tests/qgraph: virtio-scsi driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 01/33] tests: qgraph API for the qtest driver framework, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 18/33] tests/qgraph: virtio-serial driver and interface nodes, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 06/33] tests/qgraph: sdhci test node, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 13/33] tests/qgraph: virtio_start_device function, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 24/33] tests/qgraph: virtio-balloon test node, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 28/33] tests/qgraph: virtio-blk test node, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 10/33] tests/qgraph: has_buggy_msi flag, Emanuele Giuseppe Esposito, 2018/08/13
- [Qemu-block] [PATCH 02/33] tests/qgraph: rename qpci_init_pc and qpci_init_spapr functions, Emanuele Giuseppe Esposito, 2018/08/13