[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class |
Date: |
Mon, 27 Sep 2021 18:31:13 +0200 |
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>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
tests/acceptance/avocado_qemu/__init__.py | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/tests/acceptance/avocado_qemu/__init__.py
b/tests/acceptance/avocado_qemu/__init__.py
index 2b9b5dd27fe..2f59e171e49 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -20,6 +20,7 @@
from avocado.utils import cloudinit
from avocado.utils import datadrainer
from avocado.utils import network
+from avocado.utils import process
from avocado.utils import ssh
from avocado.utils import vmimage
from avocado.utils.path import find_command
@@ -300,6 +301,23 @@ def tearDown(self):
self._sd = None
+class QemuUserTest(QemuBaseTest):
+ """Facilitates user-mode emulation tests."""
+
+ def setUp(self):
+ self._ldpath = []
+ super(QemuUserTest, self).setUp('qemu-')
+
+ def add_ldpath(self, ldpath):
+ self._ldpath += [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
- [PATCH v4 0/6] tests/acceptance: Add bFLT loader linux-user test, Philippe Mathieu-Daudé, 2021/09/27
- [PATCH v4 1/6] tests/acceptance: Extract QemuBaseTest from Test, Philippe Mathieu-Daudé, 2021/09/27
- [PATCH v4 2/6] tests/acceptance: Make pick_default_qemu_bin() more generic, Philippe Mathieu-Daudé, 2021/09/27
- [PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class,
Philippe Mathieu-Daudé <=
- [PATCH v4 4/6] tests/acceptance: Share useful helpers from virtiofs_submounts test, Philippe Mathieu-Daudé, 2021/09/27
- [PATCH v4 5/6] tests/acceptance: Add bFLT loader linux-user test, Philippe Mathieu-Daudé, 2021/09/27
- [PATCH v4 6/6] tests/acceptance: Rename avocado_qemu.Test -> QemuSystemTest, Philippe Mathieu-Daudé, 2021/09/27