On Mon, Sep 27, 2021 at 1:31 PM Philippe Mathieu-Daudé <f4...@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 <waine...@redhat.com>
> Signed-off-by: Philippe Mathieu-Daudé <f4...@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 <willi...@redhat.com>

>
> --
> 2.31.1
>


Reply via email to