diff mbox series

[4/6] Acceptance Tests: log information when creating QEMUMachine

Message ID 20210211220146.2525771-5-crosa@redhat.com
State New
Headers show
Series Python / Acceptance Tests: improve logging | expand

Commit Message

Cleber Rosa Feb. 11, 2021, 10:01 p.m. UTC
Including its base temporary directory, given that information useful
for debugging can be put there.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
---
 tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Wainer dos Santos Moschetta Feb. 15, 2021, 7:15 p.m. UTC | #1
On 2/11/21 7:01 PM, Cleber Rosa wrote:
> Including its base temporary directory, given that information useful
> for debugging can be put there.
>
> Signed-off-by: Cleber Rosa <crosa@redhat.com>
> ---
>   tests/acceptance/avocado_qemu/__init__.py | 6 ++++--
>   1 file changed, 4 insertions(+), 2 deletions(-)


Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>


>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index b7ab836455..94b78fd7c8 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -170,10 +170,12 @@ class Test(avocado.Test):
>           if self.qemu_bin is None:
>               self.cancel("No QEMU binary defined or found in the build tree")
>   
> -    def _new_vm(self, *args):
> +    def _new_vm(self, name, *args):
>           self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
>           vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
>                            sock_dir=self._sd.name)
> +        self.log.debug('QEMUMachine "%s" created', name)
> +        self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir)
>           if args:
>               vm.add_args(*args)
>           return vm
> @@ -186,7 +188,7 @@ class Test(avocado.Test):
>           if not name:
>               name = str(uuid.uuid4())
>           if self._vms.get(name) is None:
> -            self._vms[name] = self._new_vm(*args)
> +            self._vms[name] = self._new_vm(name, *args)
>               if self.machine is not None:
>                   self._vms[name].set_machine(self.machine)
>           return self._vms[name]
diff mbox series

Patch

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index b7ab836455..94b78fd7c8 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -170,10 +170,12 @@  class Test(avocado.Test):
         if self.qemu_bin is None:
             self.cancel("No QEMU binary defined or found in the build tree")
 
-    def _new_vm(self, *args):
+    def _new_vm(self, name, *args):
         self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
         vm = QEMUMachine(self.qemu_bin, base_temp_dir=self.workdir,
                          sock_dir=self._sd.name)
+        self.log.debug('QEMUMachine "%s" created', name)
+        self.log.debug('QEMUMachine "%s" temp_dir: %s', name, vm.temp_dir)
         if args:
             vm.add_args(*args)
         return vm
@@ -186,7 +188,7 @@  class Test(avocado.Test):
         if not name:
             name = str(uuid.uuid4())
         if self._vms.get(name) is None:
-            self._vms[name] = self._new_vm(*args)
+            self._vms[name] = self._new_vm(name, *args)
             if self.machine is not None:
                 self._vms[name].set_machine(self.machine)
         return self._vms[name]