[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v5 3/6] tests/acceptance: Introduce QemuUserTest base class
From: |
Philippe Mathieu-Daudé |
Subject: |
[PATCH v5 3/6] tests/acceptance: Introduce QemuUserTest base class |
Date: |
Tue, 2 Nov 2021 09:42:29 +0100 |
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>
---
v5: Use PEP3135, use self._ldpath.append() method (Willian)
---
tests/acceptance/avocado_qemu/__init__.py | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/tests/acceptance/avocado_qemu/__init__.py
b/tests/acceptance/avocado_qemu/__init__.py
index 9b2ea3b248a..85bb3519969 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/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
- [PATCH v5 0/6] tests/acceptance: Add bFLT loader linux-user test, Philippe Mathieu-Daudé, 2021/11/02
- [PATCH v5 1/6] tests/acceptance: Extract QemuBaseTest from Test, Philippe Mathieu-Daudé, 2021/11/02
- [PATCH v5 2/6] tests/acceptance: Make pick_default_qemu_bin() more generic, Philippe Mathieu-Daudé, 2021/11/02
- [PATCH v5 3/6] tests/acceptance: Introduce QemuUserTest base class,
Philippe Mathieu-Daudé <=
- [PATCH v5 4/6] tests/acceptance: Share useful helpers from virtiofs_submounts test, Philippe Mathieu-Daudé, 2021/11/02
- [PATCH v5 5/6] tests/acceptance: Add bFLT loader linux-user test, Philippe Mathieu-Daudé, 2021/11/02
- [PATCH v5 6/6] tests/acceptance: Rename avocado_qemu.Test -> QemuSystemTest, Philippe Mathieu-Daudé, 2021/11/02