aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé <f4bug@amsat.org>2021-02-14 18:59:10 +0100
committerPhilippe Mathieu-Daudé <philmd@redhat.com>2021-11-08 17:00:22 +0100
commit5334df48224f494303b4717b57b2b0cd42bd1c1a (patch)
tree4b254020f65a2806d2d33e09afc66d89d6452862 /tests
parent9112d4fd493c14a30ebd5ba9853328137490aab6 (diff)
downloadqemu-5334df48224f494303b4717b57b2b0cd42bd1c1a.zip
qemu-5334df48224f494303b4717b57b2b0cd42bd1c1a.tar.gz
qemu-5334df48224f494303b4717b57b2b0cd42bd1c1a.tar.bz2
tests/avocado: Introduce QemuUserTest base class
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>
Diffstat (limited to 'tests')
-rw-r--r--tests/avocado/avocado_qemu/__init__.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/avocado/avocado_qemu/__init__.py b/tests/avocado/avocado_qemu/__init__.py
index 984c554..e46b3ec 100644
--- a/tests/avocado/avocado_qemu/__init__.py
+++ b/tests/avocado/avocado_qemu/__init__.py
@@ -17,7 +17,7 @@ import time
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 @@ class Test(QemuBaseTest):
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."""