[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v2 2/7] Acceptance Tests: introduce arch paramet
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [Qemu-devel] [PATCH v2 2/7] Acceptance Tests: introduce arch parameter and attribute |
Date: |
Wed, 10 Oct 2018 13:03:53 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 |
On 10/10/2018 01:26, Cleber Rosa wrote:
> On a number of different scenarios, such as when choosing a QEMU
> binary to be used on tests (or a image to use to boot a test VM), it's
> useful to define the architecture that should be used.
>
> This introduces both a test parameter and a test instance attribute,
> that will contain such a value.
>
> The selection of the default QEMU binary, if one is not given
> explicitly, has also been changed to look at the arch attribute.
>
> Signed-off-by: Cleber Rosa <address@hidden>
Reviewed-by: Philippe Mathieu-Daudé <address@hidden>
Tested-by: Philippe Mathieu-Daudé <address@hidden>
> ---
> docs/devel/testing.rst | 18 ++++++++++++++++++
> tests/acceptance/avocado_qemu/__init__.py | 13 ++++++++++---
> 2 files changed, 28 insertions(+), 3 deletions(-)
>
> diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
> index 727c4019b5..4178ae5022 100644
> --- a/docs/devel/testing.rst
> +++ b/docs/devel/testing.rst
> @@ -659,6 +659,17 @@ vm
> A QEMUMachine instance, initially configured according to the given
> ``qemu_bin`` parameter.
>
> +arch
> +~~~~
> +
> +The architecture that will be used on a number of different
> +scenarios. For instance, when a QEMU binary is not explicitly given,
> +the one selected will depend on this attribute.
> +
> +The ``arch`` attribute will be set to the test parameter of the same
> +name, and if one is not given explicitly, it will default to the
> +system architecture (as given by ``uname``).
> +
> qemu_bin
> ~~~~~~~~
>
> @@ -681,6 +692,13 @@ like the following:
>
> PARAMS (key=qemu_bin, path=*, default=x86_64-softmmu/qemu-system-x86_64)
> => 'x86_64-softmmu/qemu-system-x86_64
>
> +arch
> +~~~~
> +
> +The architecture that will be used on a number of different scenarios.
> +This parameter has a direct relation with the ``arch`` attribute. If
> +not given, it will default to None.
> +
> qemu_bin
> ~~~~~~~~
>
> diff --git a/tests/acceptance/avocado_qemu/__init__.py
> b/tests/acceptance/avocado_qemu/__init__.py
> index d8d5b48dac..b8d934382d 100644
> --- a/tests/acceptance/avocado_qemu/__init__.py
> +++ b/tests/acceptance/avocado_qemu/__init__.py
> @@ -23,16 +23,22 @@ def is_readable_executable_file(path):
> return os.path.isfile(path) and os.access(path, os.R_OK | os.X_OK)
>
>
> -def pick_default_qemu_bin():
> +def pick_default_qemu_bin(arch=None):
> """
> Picks the path of a QEMU binary, starting either in the current working
> directory or in the source tree root directory.
>
> + :param arch: the arch to use when looking for a QEMU binary (the target
> + will match the arch given). If None (the default) arch
> + will be the current host system arch (as given by
> + :func:`os.uname`).
> + :type arch: str
> :returns: the path to the default QEMU binary or None if one could not
> be found
> :rtype: str or None
> """
> - arch = os.uname()[4]
> + if arch is None:
> + arch = os.uname()[4]
> qemu_bin_relative_path = os.path.join("%s-softmmu" % arch,
> "qemu-system-%s" % arch)
> if is_readable_executable_file(qemu_bin_relative_path):
> @@ -47,8 +53,9 @@ def pick_default_qemu_bin():
> class Test(avocado.Test):
> def setUp(self):
> self.vm = None
> + self.arch = self.params.get('arch', default=os.uname()[4])
> self.qemu_bin = self.params.get('qemu_bin',
> - default=pick_default_qemu_bin())
> +
> default=pick_default_qemu_bin(self.arch))
> if self.qemu_bin is None:
> self.cancel("No QEMU binary defined or found in the source tree")
> self.vm = QEMUMachine(self.qemu_bin)
>
- Re: [Qemu-devel] [PATCH v2 4/7] scripts/qemu.py: set predefined machine type based on arch, (continued)
[Qemu-devel] [PATCH v2 6/7] Acceptance Tests: add variants definition for architectures, Cleber Rosa, 2018/10/09
[Qemu-devel] [PATCH v2 5/7] Acceptance Tests: set machine type, Cleber Rosa, 2018/10/09
[Qemu-devel] [PATCH v2 2/7] Acceptance Tests: introduce arch parameter and attribute, Cleber Rosa, 2018/10/09
- Re: [Qemu-devel] [PATCH v2 2/7] Acceptance Tests: introduce arch parameter and attribute,
Philippe Mathieu-Daudé <=
[Qemu-devel] [PATCH v2 7/7] Acceptance Tests: change the handling of tests for specific archs, Cleber Rosa, 2018/10/09