diff mbox series

[v2,3/3] tests/acceptance: avocado_qemu: Refactor the handler of 'machine' parameter

Message ID 20191218170003.31356-4-wainersm@redhat.com (mailing list archive)
State New, archived
Headers show
Series Acceptance tests: boot Linux with KVM test | expand

Commit Message

Wainer dos Santos Moschetta Dec. 18, 2019, 5 p.m. UTC
The Test._param_to_vm_args variable contain VM arguments that should be added
at launch which were originated from test parameters. Use this variable
to set -M from 'machine' parameter as well.

Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
---
 tests/acceptance/avocado_qemu/__init__.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Philippe Mathieu-Daudé Jan. 30, 2020, 10:55 p.m. UTC | #1
On 12/18/19 6:00 PM, Wainer dos Santos Moschetta wrote:
> The Test._param_to_vm_args variable contain VM arguments that should be added
> at launch which were originated from test parameters. Use this variable
> to set -M from 'machine' parameter as well.
> 
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
>   tests/acceptance/avocado_qemu/__init__.py | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index aff32668d9..ba9539d511 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -120,6 +120,8 @@ class Test(avocado.Test):
>   
>           self.machine = self.params.get('machine',
>                                          default=self._get_unique_tag_val('machine'))
> +        if self.machine:
> +            self._param_to_vm_args.extend(['-M', self.machine])
>   
>           default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
>           self.qemu_bin = self.params.get('qemu_bin',
> @@ -162,8 +164,6 @@ class Test(avocado.Test):
>               name = str(uuid.uuid4())
>           if self._vms.get(name) is None:
>               self._vms[name] = self._new_vm(*args)
> -            if self.machine is not None:
> -                self._vms[name].set_machine(self.machine)
>           return self._vms[name]
>   
>       def tearDown(self):
> 

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>

Also, applied to my python-next tree:
https://gitlab.com/philmd/qemu/commits/python-next
Philippe Mathieu-Daudé Jan. 30, 2020, 11:23 p.m. UTC | #2
On Thu, Jan 30, 2020 at 11:56 PM Philippe Mathieu-Daudé
<philmd@redhat.com> wrote:
> On 12/18/19 6:00 PM, Wainer dos Santos Moschetta wrote:
> > The Test._param_to_vm_args variable contain VM arguments that should be added
> > at launch which were originated from test parameters. Use this variable
> > to set -M from 'machine' parameter as well.
> >
> > Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> > ---
> >   tests/acceptance/avocado_qemu/__init__.py | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> > index aff32668d9..ba9539d511 100644
> > --- a/tests/acceptance/avocado_qemu/__init__.py
> > +++ b/tests/acceptance/avocado_qemu/__init__.py
> > @@ -120,6 +120,8 @@ class Test(avocado.Test):
> >
> >           self.machine = self.params.get('machine',
> >                                          default=self._get_unique_tag_val('machine'))
> > +        if self.machine:
> > +            self._param_to_vm_args.extend(['-M', self.machine])
> >
> >           default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
> >           self.qemu_bin = self.params.get('qemu_bin',
> > @@ -162,8 +164,6 @@ class Test(avocado.Test):
> >               name = str(uuid.uuid4())
> >           if self._vms.get(name) is None:
> >               self._vms[name] = self._new_vm(*args)
> > -            if self.machine is not None:
> > -                self._vms[name].set_machine(self.machine)
> >           return self._vms[name]
> >
> >       def tearDown(self):
> >
>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>
> Also, applied to my python-next tree:
> https://gitlab.com/philmd/qemu/commits/python-next

Oops, this depends of the previous patch (which has a v3).
I'm removing this patch.
diff mbox series

Patch

diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index aff32668d9..ba9539d511 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -120,6 +120,8 @@  class Test(avocado.Test):
 
         self.machine = self.params.get('machine',
                                        default=self._get_unique_tag_val('machine'))
+        if self.machine:
+            self._param_to_vm_args.extend(['-M', self.machine])
 
         default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
         self.qemu_bin = self.params.get('qemu_bin',
@@ -162,8 +164,6 @@  class Test(avocado.Test):
             name = str(uuid.uuid4())
         if self._vms.get(name) is None:
             self._vms[name] = self._new_vm(*args)
-            if self.machine is not None:
-                self._vms[name].set_machine(self.machine)
         return self._vms[name]
 
     def tearDown(self):