All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wainer dos Santos Moschetta <wainersm@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: "Willian Rampazzo" <willianr@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Cleber Rosa" <crosa@redhat.com>
Subject: Re: [PATCH v3 1/5] tests/acceptance: Extract QemuBaseTest from Test
Date: Wed, 17 Mar 2021 10:44:20 -0300	[thread overview]
Message-ID: <9391ac87-4b6a-a785-b1ed-c4f796d71826@redhat.com> (raw)
In-Reply-To: <f66ad969-2648-b599-f1b5-b9d01e4146ca@amsat.org>


On 3/17/21 10:26 AM, Philippe Mathieu-Daudé wrote:
> On 3/17/21 2:08 PM, Wainer dos Santos Moschetta wrote:> On 3/15/21 8:08
> PM, Philippe Mathieu-Daudé wrote:
>>> The Avocado Test::fetch_asset() is handy to download artifacts
>>> before running tests. The current class is named Test but only
>>> tests system emulation. As we want to test user emulation,
>>> refactor the common code as QemuBaseTest.
>>>
>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>> ---
>>>    tests/acceptance/avocado_qemu/__init__.py | 23 ++++++++++++++++++++---
>>>    1 file changed, 20 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/tests/acceptance/avocado_qemu/__init__.py
>>> b/tests/acceptance/avocado_qemu/__init__.py
>>> index df167b142cc..4f814047176 100644
>>> --- a/tests/acceptance/avocado_qemu/__init__.py
>>> +++ b/tests/acceptance/avocado_qemu/__init__.py
>>> @@ -155,7 +155,7 @@ def exec_command_and_wait_for_pattern(test, command,
>>>        """
>>>        _console_interaction(test, success_message, failure_message,
>>> command + '\r')
>>>    -class Test(avocado.Test):
>>> +class QemuBaseTest(avocado.Test):
>> The QemuBaseTest class still defines require_accelerator() which is only
>> used by qemu-system tests (thus, it should rather live on the Test
>> class). Same thing for self.machine, unless that property is used on
>> qemu-user tests.
> require_accelerator() has been added recently (efe30d5011b7, 2021-02-03)
> and this patch is 2 years old, so I missed that while rebasing.
>
>>>        def _get_unique_tag_val(self, tag_name):
>>>            """
>>>            Gets a tag value, if unique for a key
>>> @@ -188,8 +188,6 @@ def require_accelerator(self, accelerator):
>>>                            "available" % accelerator)
>>>          def setUp(self):
>>> -        self._vms = {}
>>> -
>>>            self.arch = self.params.get('arch',
>>>                                       
>>> default=self._get_unique_tag_val('arch'))
>>>    @@ -202,6 +200,25 @@ def setUp(self):
>>>            if self.qemu_bin is None:
>>>                self.cancel("No QEMU binary defined or found in the
>>> build tree")
>>>    +
>>> +    def fetch_asset(self, name,
>>> +                    asset_hash=None, algorithm=None,
>>> +                    locations=None, expire=None,
>>> +                    find_only=False, cancel_on_missing=True):
>>> +        return super(QemuBaseTest, self).fetch_asset(name,
>>> +                        asset_hash=asset_hash,
>>> +                        algorithm=algorithm,
>>> +                        locations=locations,
>>> +                        expire=expire,
>>> +                        find_only=find_only,
>>> +                        cancel_on_missing=cancel_on_missing)
>> Do you overwrite this fetch_asset() on class Test on purpose? I didn't
>> get why fetch_asset() is defined on the classes inherited from
>> QemuBaseTest.
> No idea. Maybe I had to do that back then, and now it is pointless.
> This is why peer-review is helpful :) I'll revisit.
>
>>> +
>>> +# a.k.a. QemuSystemTest for system emulation...
>> Above comment could become the class docstring.
> No, there should be no comment at all. We have to see if we are OK to
> rename or not. You suggested this change:
> https://www.mail-archive.com/qemu-devel@nongnu.org/msg659843.html
> But the there was more discussion and we never agreed on anything.
> I don't want to restart doing this change if it is ignored again,
> as it was a waste of time.

I stand my suggestion to rename the Test class. However, IMO this could 
be done on a separate series later after we get this merged, so to avoid 
more discussion. I can work on it myself. Sound as a good plan for you?

>
>>> +class Test(QemuBaseTest):
>>> +    def setUp(self):
>>> +        self._vms = {}
>>> +        super(Test, self).setUp()
>>> +
>>>        def _new_vm(self, *args):
>>>            self._sd = tempfile.TemporaryDirectory(prefix="avo_qemu_sock_")
>>>            vm = QEMUMachine(self.qemu_bin, sock_dir=self._sd.name)



  reply	other threads:[~2021-03-17 13:45 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 23:08 [PATCH v3 0/5] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-03-15 23:08 ` [PATCH v3 1/5] tests/acceptance: Extract QemuBaseTest from Test Philippe Mathieu-Daudé
2021-03-17 13:08   ` Wainer dos Santos Moschetta
2021-03-17 13:26     ` Philippe Mathieu-Daudé
2021-03-17 13:44       ` Wainer dos Santos Moschetta [this message]
2021-03-17 14:18         ` Philippe Mathieu-Daudé
2021-03-15 23:08 ` [PATCH v3 2/5] tests/acceptance: Make pick_default_qemu_bin() more generic Philippe Mathieu-Daudé
2021-03-17 13:32   ` Wainer dos Santos Moschetta
2021-03-15 23:08 ` [PATCH v3 3/5] tests/acceptance: Introduce QemuUserTest base class Philippe Mathieu-Daudé
2021-03-17 14:14   ` Wainer dos Santos Moschetta
2021-03-15 23:08 ` [PATCH v3 4/5] tests/acceptance: Share useful helpers from virtiofs_submounts test Philippe Mathieu-Daudé
2021-03-17 14:52   ` Wainer dos Santos Moschetta
2021-03-15 23:08 ` [PATCH v3 5/5] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé

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=9391ac87-4b6a-a785-b1ed-c4f796d71826@redhat.com \
    --to=wainersm@redhat.com \
    --cc=crosa@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=willianr@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.