qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Willian Rampazzo <wrampazz@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Cc: Warner Losh <imp@bsdimp.com>, qemu-arm <qemu-arm@nongnu.org>,
	qemu-devel <qemu-devel@nongnu.org>,
	Wainer dos Santos Moschetta <wainersm@redhat.com>,
	Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class
Date: Mon, 1 Nov 2021 15:59:00 -0300	[thread overview]
Message-ID: <CAKJDGDZhVX96L2ncsMHVc=zLi0xfwmF6XmqnqAxsekv=7wR9pQ@mail.gmail.com> (raw)
In-Reply-To: <20210927163116.1998349-4-f4bug@amsat.org>

On Mon, Sep 27, 2021 at 1:31 PM Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>
> Similarly to the 'System' Test base class with methods for testing
> system emulation, the QemuUserTest class contains methods useful to
> test user-mode emulation.
>
> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  tests/acceptance/avocado_qemu/__init__.py | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
> index 2b9b5dd27fe..2f59e171e49 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -20,6 +20,7 @@
>  from avocado.utils import cloudinit
>  from avocado.utils import datadrainer
>  from avocado.utils import network
> +from avocado.utils import process
>  from avocado.utils import ssh
>  from avocado.utils import vmimage
>  from avocado.utils.path import find_command
> @@ -300,6 +301,23 @@ def tearDown(self):
>          self._sd = None
>
>
> +class QemuUserTest(QemuBaseTest):
> +    """Facilitates user-mode emulation tests."""
> +
> +    def setUp(self):
> +        self._ldpath = []
> +        super(QemuUserTest, self).setUp('qemu-')

Consider using PEP3135,

super().setUp('qemu-')

> +
> +    def add_ldpath(self, ldpath):
> +        self._ldpath += [os.path.abspath(ldpath)]

The use of the append method is more common here:

self._ldpath.append(os.path.abspath(ldpath))

> +
> +    def run(self, bin_path, args=[]):
> +        qemu_args = " ".join(["-L %s" % ldpath for ldpath in self._ldpath])
> +        bin_args = " ".join(args)
> +        return process.run("%s %s %s %s" % (self.qemu_bin, qemu_args,
> +                                            bin_path, bin_args))
> +
> +
>  class LinuxSSHMixIn:
>      """Contains utility methods for interacting with a guest via SSH."""

Besides some Python related suggestions, the code looks good.

Reviewed-by: Willian Rampazzo <willianr@redhat.com>

>
> --
> 2.31.1
>



  reply	other threads:[~2021-11-01 19:56 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-27 16:31 [PATCH v4 0/6] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-09-27 16:31 ` [PATCH v4 1/6] tests/acceptance: Extract QemuBaseTest from Test Philippe Mathieu-Daudé
2021-11-01 18:01   ` Willian Rampazzo
2021-11-01 22:41     ` Philippe Mathieu-Daudé
2021-09-27 16:31 ` [PATCH v4 2/6] tests/acceptance: Make pick_default_qemu_bin() more generic Philippe Mathieu-Daudé
2021-11-01 18:52   ` Willian Rampazzo
2021-09-27 16:31 ` [PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class Philippe Mathieu-Daudé
2021-11-01 18:59   ` Willian Rampazzo [this message]
2021-09-27 16:31 ` [PATCH v4 4/6] tests/acceptance: Share useful helpers from virtiofs_submounts test Philippe Mathieu-Daudé
2021-11-01 19:07   ` Willian Rampazzo
2021-09-27 16:31 ` [PATCH v4 5/6] tests/acceptance: Add bFLT loader linux-user test Philippe Mathieu-Daudé
2021-11-01 17:51   ` Willian Rampazzo
2021-11-01 22:41     ` Philippe Mathieu-Daudé
2021-09-27 16:31 ` [PATCH v4 6/6] tests/acceptance: Rename avocado_qemu.Test -> QemuSystemTest Philippe Mathieu-Daudé
2021-11-01 19:11   ` Willian Rampazzo
2021-11-01 22:42     ` Philippe Mathieu-Daudé
2021-10-25 13:44 ` [PATCH v4 0/6] 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='CAKJDGDZhVX96L2ncsMHVc=zLi0xfwmF6XmqnqAxsekv=7wR9pQ@mail.gmail.com' \
    --to=wrampazz@redhat.com \
    --cc=f4bug@amsat.org \
    --cc=imp@bsdimp.com \
    --cc=laurent@vivier.eu \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=wainersm@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).