All of lore.kernel.org
 help / color / mirror / Atom feed
From: Cleber Rosa <crosa@redhat.com>
To: Wainer dos Santos Moschetta <wainersm@redhat.com>
Cc: wrampazz@redhat.com, alex.bennee@linaro.org,
	qemu-devel@nongnu.org, pavel.dovgaluk@ispras.ru,
	pbonzini@redhat.com, philmd@redhat.com, aurelien@aurel32.net
Subject: Re: [PATCH 1/3] tests/acceptance: Automatic set -cpu to the test vm
Date: Tue, 9 Mar 2021 13:40:07 -0500	[thread overview]
Message-ID: <20210309184007.GA2155904@amachine.somewhere> (raw)
In-Reply-To: <20210224212654.1146167-2-wainersm@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 3057 bytes --]

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.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2021-03-09 20:17 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-24 21:26 [PATCH 0/3] tests/acceptance: Handle tests with "cpu" tag Wainer dos Santos Moschetta
2021-02-24 21:26 ` [PATCH 1/3] tests/acceptance: Automatic set -cpu to the test vm Wainer dos Santos Moschetta
2021-03-09 18:40   ` Cleber Rosa [this message]
2021-02-24 21:26 ` [PATCH 2/3] tests/acceptance: Let the framework handle "cpu:VALUE" tagged tests Wainer dos Santos Moschetta
2021-03-09 19:04   ` Cleber Rosa
2021-02-24 21:26 ` [PATCH 3/3] tests/acceptance: Tagging tests with "cpu:VALUE" Wainer dos Santos Moschetta
2021-03-09 19:18   ` Cleber Rosa
2021-03-09 18:52 ` [PATCH 0/3] tests/acceptance: Handle tests with "cpu" tag Cleber Rosa
2021-03-17 19:16   ` Wainer dos Santos Moschetta
2021-03-23 21:01     ` John Snow
2021-04-07 20:01       ` Eduardo Habkost
2021-04-09 14:53         ` Wainer dos Santos Moschetta
2021-05-14 19:36           ` John Snow

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210309184007.GA2155904@amachine.somewhere \
    --to=crosa@redhat.com \
    --cc=alex.bennee@linaro.org \
    --cc=aurelien@aurel32.net \
    --cc=pavel.dovgaluk@ispras.ru \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@redhat.com \
    --cc=wrampazz@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.