[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/3] tests/acceptance: Automatic set -cpu to the test vm
From: |
Cleber Rosa |
Subject: |
Re: [PATCH 1/3] tests/acceptance: Automatic set -cpu to the test vm |
Date: |
Tue, 9 Mar 2021 13:40:07 -0500 |
On Wed, Feb 24, 2021 at 06:26:52PM -0300, Wainer dos Santos Moschetta wrote:
> This introduces a new feature to the functional tests: automatic setting of
> the '-cpu VALUE' option to the created vm if the test is tagged with
> 'cpu:VALUE'. The 'cpu' property is made available to the test object as well.
>
> For example, for a simple test as:
>
> def test(self):
> """
> :avocado: tags=cpu:host
> """
> self.assertEqual(self.cpu, "host")
> self.vm.launch()
>
> The resulted QEMU evocation will be like:
>
Maybe you meant "resulting" ?
> qemu-system-x86_64 -display none -vga none -chardev
> socket,id=mon,path=/var/tmp/avo_qemu_sock_pdgzbgd_/qemu-1135557-monitor.sock
> -mon chardev=mon,mode=control -cpu host
>
> Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> ---
> docs/devel/testing.rst | 8 ++++++++
> tests/acceptance/avocado_qemu/__init__.py | 4 ++++
> 2 files changed, 12 insertions(+)
>
> diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
> index 00ce16de48..40478672c0 100644
> --- a/docs/devel/testing.rst
> +++ b/docs/devel/testing.rst
> @@ -844,6 +844,14 @@ name. If one is not given explicitly, it will either be
> set to
> ``None``, or, if the test is tagged with one (and only one)
> ``:avocado: tags=arch:VALUE`` tag, it will be set to ``VALUE``.
>
> +cpu
> +~~~
> +
> +If the test is tagged with one (and only one) ``:avocado: tags=cpu:VALUE``
> tag
> +then the ``cpu`` attribute will be set to ``VALUE``, and the ``-cpu``
> argument
> +will be set to all QEMUMachine instances created by the test. Otherwise the
> +attribute will be set to ``None``.
> +
> machine
> ~~~~~~~
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py
> b/tests/acceptance/avocado_qemu/__init__.py
> index df167b142c..0f4649b173 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -193,6 +193,8 @@ def setUp(self):
> self.arch = self.params.get('arch',
> default=self._get_unique_tag_val('arch'))
>
> + self.cpu = self._get_unique_tag_val('cpu')
> +
> self.machine = self.params.get('machine',
>
> default=self._get_unique_tag_val('machine'))
>
> @@ -218,6 +220,8 @@ def get_vm(self, *args, name=None):
> name = str(uuid.uuid4())
> if self._vms.get(name) is None:
> self._vms[name] = self._new_vm(*args)
> + if self.cpu is not None:
> + self._vms[name].add_args('-cpu', self.cpu)
> if self.machine is not None:
> self._vms[name].set_machine(self.machine)
> return self._vms[name]
> --
> 2.29.2
>
Did you omit the support for the "cpu" parameter on purpose? Unless
there's a good argument against it, I'd say we should try to keep
those tags/parameters/attributes consistently available.
Cheers,
- Cleber.
signature.asc
Description: PGP signature
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 1/3] tests/acceptance: Automatic set -cpu to the test vm,
Cleber Rosa <=