qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
	"Aleksandar Rikalo" <arikalo@wavecomp.com>,
	"Willian Rampazzo" <wrampazz@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Aurelien Jarno" <aurelien@aurel32.net>
Subject: Re: [PATCH 2/3] Acceptance tests: introduce utility method for tags unique vals
Date: Thu, 7 Nov 2019 16:29:03 -0200	[thread overview]
Message-ID: <9a7e3c76-1b35-1260-d798-280981520f11@redhat.com> (raw)
In-Reply-To: <20191028230259.GA6770@localhost.localdomain>


On 10/28/19 8:02 PM, Cleber Rosa wrote:
> On Thu, Oct 24, 2019 at 06:12:25PM -0300, Wainer dos Santos Moschetta wrote:
>> Hi Cleber,
>>
>> On 9/24/19 4:45 PM, Cleber Rosa wrote:
>>> Currently a test can describe the target architecture binary that it
>>> should primarily be run with, be setting a single tag value.
>>>
>>> The same approach is expected to be done with other QEMU aspects to be
>>> tested, for instance, the machine type and accelerator, so let's
>>> generalize the logic into a utility method.
>>>
>>> Signed-off-by: Cleber Rosa <crosa@redhat.com>
>>> ---
>>>    tests/acceptance/avocado_qemu/__init__.py | 19 +++++++++++++------
>>>    1 file changed, 13 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
>>> index bd41e0443c..02775bafcf 100644
>>> --- a/tests/acceptance/avocado_qemu/__init__.py
>>> +++ b/tests/acceptance/avocado_qemu/__init__.py
>>> @@ -54,14 +54,21 @@ def pick_default_qemu_bin(arch=None):
>>>    class Test(avocado.Test):
>>> +    def _get_unique_tag_val(self, tag_name):
>>> +        """
>>> +        Gets a tag value, if unique for a key
>>> +        """
>>> +        vals = self.tags.get(tag_name, [])
>>> +        if len(vals) == 1:
>>
>> An small optimization:
>>
>> if vals:
>>
>>    return vals.pop()
>>
> IIUC, this would break the idea of uniqueness that this method, for
> now, has.  Read on.
>
>>> +            return vals.pop()
>>> +        return None
>> Does it allows to express a scenario like "I want my test method to run on
>> x86_64 and aarch64" using tags? If so, _get_unique_tag_val logic returns
>> None for multi-value tags (e.g. 'tags=arch:x86_64,arch:aarch64').
>>
> I thought that initially we should attempt to pick a default arch or
> machine type only of len(vals) == 1.  Not because what you describe
> can't be done, but because I would like to go through the tests and
> make sure we run them in all the given tagged arches when we allow
> that.

Ok, understood the rationale now.

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

>
> Thanks,
> - Cleber.
>
>> Thanks,
>>
>> Wainer
>>
>>> +
>>>        def setUp(self):
>>>            self._vms = {}
>>> -        arches = self.tags.get('arch', [])
>>> -        if len(arches) == 1:
>>> -            arch = arches.pop()
>>> -        else:
>>> -            arch = None
>>> -        self.arch = self.params.get('arch', default=arch)
>>> +
>>> +        self.arch = self.params.get('arch',
>>> +                                    default=self._get_unique_tag_val('arch'))
>>> +
>>>            default_qemu_bin = pick_default_qemu_bin(arch=self.arch)
>>>            self.qemu_bin = self.params.get('qemu_bin',
>>>                                            default=default_qemu_bin)
>



  reply	other threads:[~2019-11-07 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-24 19:44 [PATCH 0/3] Acceptance tests: make better use of machine tags Cleber Rosa
2019-09-24 19:44 ` [PATCH 1/3] Acceptance test x86_cpu_model_versions: use default vm Cleber Rosa
2019-09-24 19:45 ` [PATCH 2/3] Acceptance tests: introduce utility method for tags unique vals Cleber Rosa
2019-10-24 21:12   ` Wainer dos Santos Moschetta
2019-10-28 23:02     ` Cleber Rosa
2019-11-07 18:29       ` Wainer dos Santos Moschetta [this message]
2019-09-24 19:45 ` [PATCH 3/3] Acceptance Tests: use avocado tags for machine type Cleber Rosa
2019-10-24 21:24   ` Wainer dos Santos Moschetta
2019-09-25  8:03 ` [PATCH 0/3] Acceptance tests: make better use of machine tags no-reply

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=9a7e3c76-1b35-1260-d798-280981520f11@redhat.com \
    --to=wainersm@redhat.com \
    --cc=arikalo@wavecomp.com \
    --cc=aurelien@aurel32.net \
    --cc=crosa@redhat.com \
    --cc=ehabkost@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).