qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 1/2] Acceptance Tests: add QemuImgTest base clas


From: Cleber Rosa
Subject: [Qemu-devel] [RFC PATCH 1/2] Acceptance Tests: add QemuImgTest base class
Date: Fri, 9 Nov 2018 17:12:12 -0500

Testing other utilities such as qemu-img do not require the same
infrastructure that testing QEMU itself does.  Let's add a base class
that just sets the suitable qemu-img binary to be used during test.

Signed-off-by: Cleber Rosa <address@hidden>
---
 tests/acceptance/avocado_qemu/__init__.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/tests/acceptance/avocado_qemu/__init__.py 
b/tests/acceptance/avocado_qemu/__init__.py
index 1e54fd5932..dfd147b7e2 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -40,6 +40,20 @@ def pick_default_qemu_bin():
         return qemu_bin_from_src_dir_path
 
 
+def pick_default_qemu_img_bin():
+    """
+    Picks the path of a QEMU binary, starting either in the current working
+    directory or in the source tree root directory.
+    """
+    qemu_img_bin_local = os.path.abspath("qemu-img")
+    if is_readable_executable_file(qemu_img_bin_local):
+        return qemu_img_bin_local
+
+    qemu_img_bin_from_src_dir_path = os.path.join(SRC_ROOT_DIR, "qemu-img")
+    if is_readable_executable_file(qemu_img_bin_from_src_dir_path):
+        return qemu_img_bin_from_src_dir_path
+
+
 class Test(avocado.Test):
     def setUp(self):
         self.vm = None
@@ -52,3 +66,9 @@ class Test(avocado.Test):
     def tearDown(self):
         if self.vm is not None:
             self.vm.shutdown()
+
+
+class QemuImgTest(avocado.Test):
+    def setUp(self):
+        self.qemu_img_bin = self.params.get('qemu_img_bin',
+                                            
default=pick_default_qemu_img_bin())
-- 
2.19.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]