qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>,
	"Samuel Thibault" <samuel.thibault@ens-lyon.org>
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
	"Warner Losh" <imp@bsdimp.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Daniel P . Berrange" <berrange@redhat.com>
Subject: [PATCH 5/6] tests/avocado: Do not run tests that require libslirp if it is not available
Date: Wed, 24 Aug 2022 17:11:21 +0200	[thread overview]
Message-ID: <20220824151122.704946-6-thuth@redhat.com> (raw)
In-Reply-To: <20220824151122.704946-1-thuth@redhat.com>

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.

Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 tests/avocado/avocado_qemu/__init__.py | 7 +++++++
 tests/avocado/info_usernet.py          | 1 +
 tests/avocado/replay_linux.py          | 1 +
 3 files changed, 9 insertions(+)

diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index ed4853c805..5ebf5c1766 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -295,6 +295,12 @@ def require_accelerator(self, accelerator):
             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,
@@ -547,6 +553,7 @@ def _set_distro(self):
 
     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)
diff --git a/tests/avocado/info_usernet.py b/tests/avocado/info_usernet.py
index dc01f74150..b862a47dba 100644
--- a/tests/avocado/info_usernet.py
+++ b/tests/avocado/info_usernet.py
@@ -16,6 +16,7 @@
 class InfoUsernet(QemuSystemTest):
 
     def test_hostfwd(self):
+        self.require_netdev('user')
         self.vm.add_args('-netdev', 'user,id=vnet,hostfwd=:127.0.0.1:0-:22')
         self.vm.launch()
         res = self.vm.command('human-monitor-command',
diff --git a/tests/avocado/replay_linux.py b/tests/avocado/replay_linux.py
index e1f9981a34..a76dd507fc 100644
--- a/tests/avocado/replay_linux.py
+++ b/tests/avocado/replay_linux.py
@@ -55,6 +55,7 @@ def vm_add_disk(self, vm, path, id, device):
             '%s,drive=disk%s-rr%s' % (device, id, bus_string))
 
     def launch_and_wait(self, record, args, shift):
+        self.require_netdev('user')
         vm = self.get_vm()
         vm.add_args('-smp', '1')
         vm.add_args('-m', '1024')
-- 
2.31.1



  parent reply	other threads:[~2022-08-24 15:14 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-24 15:11 [PATCH v2 for-7.2 0/6] Drop libslirp submodule Thomas Huth
2022-08-24 15:11 ` [PATCH 1/6] tests/docker: Update the debian-all-test-cross container to Debian 11 Thomas Huth
2022-08-24 15:11 ` [PATCH 2/6] tests/vm: Add libslirp to the VM tests Thomas Huth
2022-08-24 15:11 ` [PATCH 3/6] tests/lcitool/libvirt-ci: Update the lcitool module to the latest version Thomas Huth
2022-08-24 15:11 ` [PATCH 4/6] tests: Refresh dockerfiles and FreeBSD vars with lcitool Thomas Huth
2022-08-24 15:11 ` Thomas Huth [this message]
2022-08-24 15:11 ` [PATCH v2 6/6] Remove the slirp submodule (i.e. compile only with an external libslirp) Thomas Huth
2022-08-24 19:46 ` [PATCH v2 for-7.2 0/6] Drop libslirp submodule Samuel Thibault
2022-09-30 16:50 ` Christian Schoenebeck
2022-09-30 17:27   ` Thomas Huth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220824151122.704946-6-thuth@redhat.com \
    --to=thuth@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=berrange@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=imp@bsdimp.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=samuel.thibault@ens-lyon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).