aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/avocado/acpi-bits.py8
-rwxr-xr-xtests/qemu-iotests/1722
-rw-r--r--tests/qtest/cdrom-test.c16
-rw-r--r--tests/qtest/device-plug-test.c9
-rw-r--r--tests/qtest/meson.build12
-rw-r--r--tests/qtest/readconfig-test.c5
-rw-r--r--tests/qtest/usb-hcd-uhci-test.c5
-rw-r--r--tests/qtest/virtio-ccw-test.c43
8 files changed, 54 insertions, 46 deletions
diff --git a/tests/avocado/acpi-bits.py b/tests/avocado/acpi-bits.py
index 14038fa3c4..3ed286dcbd 100644
--- a/tests/avocado/acpi-bits.py
+++ b/tests/avocado/acpi-bits.py
@@ -123,9 +123,9 @@ class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods
"""return the base argument to QEMU binary"""
return self._base_args
-@skipIf(not supported_platform() or missing_deps() or os.getenv('GITLAB_CI'),
- 'incorrect platform or dependencies (%s) not installed ' \
- 'or running on GitLab' % ','.join(deps))
+@skipIf(not supported_platform() or missing_deps(),
+ 'unsupported platform or dependencies (%s) not installed' \
+ % ','.join(deps))
class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
"""
ACPI and SMBIOS tests using biosbits.
@@ -356,7 +356,7 @@ class AcpiBitsTest(QemuBaseTest): #pylint: disable=too-many-instance-attributes
"""
if self._vm:
self.assertFalse(not self._vm.is_running)
- if not os.getenv('BITS_DEBUG'):
+ if not os.getenv('BITS_DEBUG') and self._workDir:
self.logger.info('removing the work directory %s', self._workDir)
shutil.rmtree(self._workDir)
else:
diff --git a/tests/qemu-iotests/172 b/tests/qemu-iotests/172
index ff269ca7b5..4da0e0f2e2 100755
--- a/tests/qemu-iotests/172
+++ b/tests/qemu-iotests/172
@@ -56,7 +56,7 @@ do_run_qemu()
done
fi
echo quit
- ) | $QEMU -accel qtest -nographic -monitor stdio -serial none "$@"
+ ) | $QEMU -accel qtest -nographic -monitor stdio -serial none -vga none -nic none "$@"
echo
}
diff --git a/tests/qtest/cdrom-test.c b/tests/qtest/cdrom-test.c
index 2b7e10d920..d1cc375849 100644
--- a/tests/qtest/cdrom-test.c
+++ b/tests/qtest/cdrom-test.c
@@ -136,9 +136,12 @@ static void add_x86_tests(void)
}
qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
- qtest_add_data_func("cdrom/boot/virtio-scsi",
- "-device virtio-scsi -device scsi-cd,drive=cdr "
- "-blockdev file,node-name=cdr,filename=", test_cdboot);
+ if (qtest_has_device("virtio-scsi-ccw")) {
+ qtest_add_data_func("cdrom/boot/virtio-scsi",
+ "-device virtio-scsi -device scsi-cd,drive=cdr "
+ "-blockdev file,node-name=cdr,filename=",
+ test_cdboot);
+ }
/*
* Unstable CI test under load
* See https://lists.gnu.org/archive/html/qemu-devel/2019-02/msg05509.html
@@ -183,10 +186,17 @@ static void add_s390x_tests(void)
{
if (!qtest_has_accel("tcg") && !qtest_has_accel("kvm")) {
g_test_skip("No KVM or TCG accelerator available, skipping boot tests");
+ }
+ if (!qtest_has_device("virtio-blk-ccw")) {
return;
}
qtest_add_data_func("cdrom/boot/default", "-cdrom ", test_cdboot);
+
+ if (!qtest_has_device("virtio-scsi-ccw")) {
+ return;
+ }
+
qtest_add_data_func("cdrom/boot/virtio-scsi",
"-device virtio-scsi -device scsi-cd,drive=cdr "
"-blockdev file,node-name=cdr,filename=", test_cdboot);
diff --git a/tests/qtest/device-plug-test.c b/tests/qtest/device-plug-test.c
index 01cecd6e20..abd544b70c 100644
--- a/tests/qtest/device-plug-test.c
+++ b/tests/qtest/device-plug-test.c
@@ -156,7 +156,14 @@ static void test_q35_pci_unplug_json_request(void)
static void test_ccw_unplug(void)
{
- QTestState *qtest = qtest_initf("-device virtio-balloon-ccw,id=dev0");
+ QTestState *qtest;
+
+ if (!qtest_has_device("virtio-balloon-ccw")) {
+ g_test_skip("Device virtio-balloon-ccw not available");
+ return;
+ }
+
+ qtest = qtest_initf("-device virtio-balloon-ccw,id=dev0");
qtest_qmp_device_del_send(qtest, "dev0");
wait_device_deleted_event(qtest, "dev0");
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index ab422772d3..4c5585ac0f 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -34,10 +34,12 @@ qtests_pci = \
qtests_cxl = \
(config_all_devices.has_key('CONFIG_CXL') ? ['cxl-test'] : [])
+# FIXME: Get rid of get_option('default_devices') here and check
+# for the availability of the default NICs in the tests
qtests_filter = \
- (slirp.found() ? ['test-netfilter'] : []) + \
- (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \
- (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : [])
+ (get_option('default_devices') and slirp.found() ? ['test-netfilter'] : []) + \
+ (get_option('default_devices') and config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \
+ (get_option('default_devices') and config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : [])
qtests_i386 = \
(slirp.found() ? ['pxe-test'] : []) + \
@@ -221,9 +223,7 @@ qtests_aarch64 = \
'migration-test']
qtests_s390x = \
- (slirp.found() ? ['pxe-test', 'test-netfilter'] : []) + \
- (config_host.has_key('CONFIG_POSIX') ? ['test-filter-mirror'] : []) + \
- (config_host.has_key('CONFIG_POSIX') ? ['test-filter-redirector'] : []) + \
+ qtests_filter + \
['boot-serial-test',
'drive_del-test',
'device-plug-test',
diff --git a/tests/qtest/readconfig-test.c b/tests/qtest/readconfig-test.c
index 918d45684b..ac7242451b 100644
--- a/tests/qtest/readconfig-test.c
+++ b/tests/qtest/readconfig-test.c
@@ -207,7 +207,10 @@ int main(int argc, char *argv[])
if (g_str_equal(arch, "i386") ||
g_str_equal(arch, "x86_64")) {
qtest_add_func("readconfig/x86/memdev", test_x86_memdev);
- qtest_add_func("readconfig/x86/ich9-ehci-uhci", test_docs_config_ich9);
+ if (qtest_has_device("ich9-usb-ehci1") &&
+ qtest_has_device("ich9-usb-uhci1")) {
+ qtest_add_func("readconfig/x86/ich9-ehci-uhci", test_docs_config_ich9);
+ }
}
#if defined(CONFIG_SPICE) && !defined(__FreeBSD__)
qtest_add_func("readconfig/spice", test_spice);
diff --git a/tests/qtest/usb-hcd-uhci-test.c b/tests/qtest/usb-hcd-uhci-test.c
index f264d2bf73..84ac2f3c1a 100644
--- a/tests/qtest/usb-hcd-uhci-test.c
+++ b/tests/qtest/usb-hcd-uhci-test.c
@@ -66,6 +66,11 @@ int main(int argc, char **argv)
g_test_init(&argc, &argv, NULL);
+ if (!qtest_has_device("piix3-usb-uhci")) {
+ g_debug("piix3-usb-uhci not available");
+ return 0;
+ }
+
qtest_add_func("/uhci/pci/init", test_uhci_init);
qtest_add_func("/uhci/pci/port1", test_port_1);
qtest_add_func("/uhci/pci/hotplug", test_uhci_hotplug);
diff --git a/tests/qtest/virtio-ccw-test.c b/tests/qtest/virtio-ccw-test.c
index 2de77bb6fe..f4f5858b84 100644
--- a/tests/qtest/virtio-ccw-test.c
+++ b/tests/qtest/virtio-ccw-test.c
@@ -17,12 +17,6 @@
#include "libqtest-single.h"
#include "libqos/virtio.h"
-static void virtio_balloon_nop(void)
-{
- global_qtest = qtest_initf("-device virtio-balloon-ccw");
- qtest_end();
-}
-
static void virtconsole_nop(void)
{
global_qtest = qtest_initf("-device virtio-serial-ccw,id=vser0 "
@@ -53,20 +47,6 @@ static void virtio_serial_hotplug(void)
qtest_quit(qts);
}
-static void virtio_blk_nop(void)
-{
- global_qtest = qtest_initf("-drive if=none,id=drv0,file=null-co://,"
- "file.read-zeroes=on,format=raw "
- "-device virtio-blk-ccw,drive=drv0");
- qtest_end();
-}
-
-static void virtio_net_nop(void)
-{
- global_qtest = qtest_initf("-device virtio-net-ccw");
- qtest_end();
-}
-
static void virtio_rng_nop(void)
{
global_qtest = qtest_initf("-device virtio-rng-ccw");
@@ -96,16 +76,19 @@ static void virtio_scsi_hotplug(void)
int main(int argc, char **argv)
{
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/rng/nop", virtio_rng_nop);
- qtest_add_func("/virtio/scsi/nop", virtio_scsi_nop);
- qtest_add_func("/virtio/scsi/hotplug", virtio_scsi_hotplug);
+ if (qtest_has_device("virtio-serial-ccw")) {
+ 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);
+ }
+ if (qtest_has_device("virtio-rng-ccw")) {
+ qtest_add_func("/virtio/rng/nop", virtio_rng_nop);
+ }
+ if (qtest_has_device("virtio-rng-ccw")) {
+ qtest_add_func("/virtio/scsi/nop", virtio_scsi_nop);
+ qtest_add_func("/virtio/scsi/hotplug", virtio_scsi_hotplug);
+ }
return g_test_run();
}