[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 38/42] tests/acceptance: Extract QemuBaseTest from Test
From: |
Philippe Mathieu-Daudé |
Subject: |
[RFC PATCH 38/42] tests/acceptance: Extract QemuBaseTest from Test |
Date: |
Sun, 14 Feb 2021 18:59:08 +0100 |
The Avocado Test::fetch_asset() is handy to download artifacts
before running tests. The current class is named Test but only
tests system emulation. As we want to test user emulation,
refactor the common code as QemuBaseTest.
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
tests/acceptance/avocado_qemu/__init__.py | 35 +++++++++++++----------
1 file changed, 20 insertions(+), 15 deletions(-)
diff --git a/tests/acceptance/avocado_qemu/__init__.py
b/tests/acceptance/avocado_qemu/__init__.py
index bf54e419da2..31b7064c0e5 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -145,7 +145,7 @@ def exec_command_and_wait_for_pattern(test, command,
"""
_console_interaction(test, success_message, failure_message, command +
'\r')
-class Test(avocado.Test):
+class QemuBaseTest(avocado.Test):
def _get_unique_tag_val(self, tag_name):
"""
Gets a tag value, if unique for a key
@@ -156,8 +156,6 @@ def _get_unique_tag_val(self, tag_name):
return None
def setUp(self):
- self._vms = {}
-
self.arch = self.params.get('arch',
default=self._get_unique_tag_val('arch'))
@@ -170,6 +168,25 @@ def setUp(self):
if self.qemu_bin is None:
self.cancel("No QEMU binary defined or found in the build tree")
+
+ def fetch_asset(self, name,
+ asset_hash=None, algorithm=None,
+ locations=None, expire=None,
+ find_only=False, cancel_on_missing=True):
+ return super(QemuBaseTest, self).fetch_asset(name,
+ asset_hash=asset_hash,
+ algorithm=algorithm,
+ locations=locations,
+ expire=expire,
+ find_only=find_only,
+ cancel_on_missing=cancel_on_missing)
+
+# a.k.a. QemuSystemTest for system emulation...
+class Test(QemuBaseTest):
+ def setUp(self):
+ self._vms = {}
+ super(Test, self).setUp()
+
def _new_vm(self, *args):
self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
vm = QEMUMachine(self.qemu_bin, sock_dir=self._sd.name)
@@ -194,15 +211,3 @@ def tearDown(self):
for vm in self._vms.values():
vm.shutdown()
self._sd = None
-
- def fetch_asset(self, name,
- asset_hash=None, algorithm=None,
- locations=None, expire=None,
- find_only=False, cancel_on_missing=True):
- return super(Test, self).fetch_asset(name,
- asset_hash=asset_hash,
- algorithm=algorithm,
- locations=locations,
- expire=expire,
- find_only=find_only,
- cancel_on_missing=cancel_on_missing)
--
2.26.2
- [RFC PATCH 33/42] gitlab-ci: Pass optional EXTRA_FILES when building docker images, (continued)
- [RFC PATCH 33/42] gitlab-ci: Pass optional EXTRA_FILES when building docker images, Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 34/42] gitlab-ci: Build MIPS R5900 cross-toolchain (Gentoo based), Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 35/42] tests/tcg: Add MIPS R5900 to arches filter, Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 36/42] tests/tcg/mips: Test user mode DMULT for the R5900, Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 37/42] gitlab-ci: Add job to test the MIPS r5900o32el target, Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 38/42] tests/acceptance: Extract QemuBaseTest from Test,
Philippe Mathieu-Daudé <=
- [RFC PATCH 39/42] tests/acceptance: Make pick_default_qemu_bin() more generic, Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 40/42] tests/acceptance: Introduce QemuUserTest base class, Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 41/42] tests/acceptance: Test R5900 CPU with BusyBox from Sony PS2, Philippe Mathieu-Daudé, 2021/02/14
- [RFC PATCH 42/42] gitlab-ci: Add job to run integration tests for the r5900o32el target, Philippe Mathieu-Daudé, 2021/02/14
- Re: [RFC PATCH 00/42] target/mips: Reintroduce the R5900 CPU (with more testing), Philippe Mathieu-Daudé, 2021/02/14
- Re: [RFC PATCH 00/42] target/mips: Reintroduce the R5900 CPU (with more testing), Philippe Mathieu-Daudé, 2021/02/15
- Re: [RFC PATCH 00/42] target/mips: Reintroduce the R5900 CPU (with more testing), Philippe Mathieu-Daudé, 2021/02/21