qemu-arm
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class


From: Willian Rampazzo
Subject: Re: [PATCH v4 3/6] tests/acceptance: Introduce QemuUserTest base class
Date: Mon, 1 Nov 2021 15:59:00 -0300

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 via email to

[Prev in Thread] Current Thread [Next in Thread]