aboutsummaryrefslogtreecommitdiff
path: root/tests/avocado/avocado_qemu
diff options
context:
space:
mode:
authorThomas Huth <thuth@redhat.com>2022-08-24 17:11:21 +0200
committerThomas Huth <thuth@redhat.com>2022-08-29 15:28:51 +0200
commit0fc389fe9208f0bfd9fa41cd7e6315a0989a3729 (patch)
tree497c0c21127ac9bec022146f2a0144aae3f64114 /tests/avocado/avocado_qemu
parent0026be1d0f836ee899b47c6b925fdfc9baa9fd2f (diff)
downloadqemu-0fc389fe9208f0bfd9fa41cd7e6315a0989a3729.zip
qemu-0fc389fe9208f0bfd9fa41cd7e6315a0989a3729.tar.gz
qemu-0fc389fe9208f0bfd9fa41cd7e6315a0989a3729.tar.bz2
tests/avocado: Do not run tests that require libslirp if it is not available
Some avocado tests blindly assume that QEMU has been compiled with libslirp enabled and fail badly if it is missing. Add a proper check to cancel the tests in this case. Message-Id: <20220824151122.704946-6-thuth@redhat.com> Acked-by: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'tests/avocado/avocado_qemu')
-rw-r--r--tests/avocado/avocado_qemu/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index 9d17a28..3b5b8e7 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -299,6 +299,12 @@ class QemuSystemTest(QemuBaseTest):
self.cancel("%s accelerator does not seem to be "
"available" % accelerator)
+ def require_netdev(self, netdevname):
+ netdevhelp = run_cmd([self.qemu_bin,
+ '-M', 'none', '-netdev', 'help'])[0];
+ if netdevhelp.find('\n' + netdevname + '\n') < 0:
+ self.cancel('no support for user networking')
+
def _new_vm(self, name, *args):
self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
@@ -550,6 +556,7 @@ class LinuxTest(LinuxSSHMixIn, QemuSystemTest):
def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
super().setUp()
+ self.require_netdev('user')
self._set_distro()
self.vm.add_args('-smp', self.smp)
self.vm.add_args('-m', self.memory)