All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Willian Rampazzo" <willianr@redhat.com>,
	"Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Wainer dos Santos Moschetta" <wainersm@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: [PULL 5/9] tests/avocado: Introduce QemuUserTest base class
Date: Mon,  8 Nov 2021 17:17:35 +0100	[thread overview]
Message-ID: <20211108161739.1371503-6-philmd@redhat.com> (raw)
In-Reply-To: <20211108161739.1371503-1-philmd@redhat.com>

From: Philippe Mathieu-Daudé <f4bug@amsat.org>

Similarly to the 'System' Test base class with methods for testing
system emulation, the QemuUserTest class contains methods useful to
test user-mode emulation.

Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20211105143416.148332-4-f4bug@amsat.org>
---
 tests/avocado/avocado_qemu/__init__.py | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index 984c554e7d6..e46b3ecb89e 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -17,7 +17,7 @@
 import uuid
 
 import avocado
-from avocado.utils import cloudinit, datadrainer, network, ssh, vmimage
+from avocado.utils import cloudinit, datadrainer, network, process, ssh, vmimage
 from avocado.utils.path import find_command
 
 #: The QEMU build root directory.  It may also be the source directory
@@ -295,6 +295,23 @@ def tearDown(self):
         super().tearDown()
 
 
+class QemuUserTest(QemuBaseTest):
+    """Facilitates user-mode emulation tests."""
+
+    def setUp(self):
+        self._ldpath = []
+        super().setUp('qemu-')
+
+    def add_ldpath(self, ldpath):
+        self._ldpath.append(os.path.abspath(ldpath))
+
+    def run(self, bin_path, args=[]):
+        qemu_args = " ".join(["-L %s" % ldpath for ldpath in self._ldpath])
+        bin_args = " ".join(args)
+        return process.run("%s %s %s %s" % (self.qemu_bin, qemu_args,
+                                            bin_path, bin_args))
+
+
 class LinuxSSHMixIn:
     """Contains utility methods for interacting with a guest via SSH."""
 
-- 
2.31.1



  parent reply	other threads:[~2021-11-08 16:22 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-08 16:17 [PULL 0/9] Integration testing patches for 2021-11-08 Philippe Mathieu-Daudé
2021-11-08 16:17 ` [PULL 1/9] tests/acceptance: introduce new check-avocado target Philippe Mathieu-Daudé
2021-11-08 16:17 ` [PULL 2/9] tests/acceptance: rename tests acceptance to tests avocado Philippe Mathieu-Daudé
2021-11-08 16:17 ` [PULL 3/9] tests/avocado: Extract QemuBaseTest from Test Philippe Mathieu-Daudé
2021-11-08 16:17 ` [PULL 4/9] tests/avocado: Make pick_default_qemu_bin() more generic Philippe Mathieu-Daudé
2021-11-08 16:17 ` Philippe Mathieu-Daudé [this message]
2021-11-08 16:17 ` [PULL 6/9] tests/avocado: Share useful helpers from virtiofs_submounts test Philippe Mathieu-Daudé
2021-11-08 16:17 ` [PULL 7/9] tests/avocado: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-11-08 16:17 ` [PULL 8/9] tests/avocado: Rename avocado_qemu.Test -> QemuSystemTest Philippe Mathieu-Daudé
2021-11-08 16:17 ` [PULL 9/9] tests/avocado: Remove p7zip binary availability check Philippe Mathieu-Daudé
2021-11-08 19:37 ` [PULL 0/9] Integration testing patches for 2021-11-08 Richard Henderson

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=20211108161739.1371503-6-philmd@redhat.com \
    --to=philmd@redhat.com \
    --cc=crosa@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    --cc=willianr@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.