[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] avocado_qemu: add AVOCADO_DEFAULT_MACHINE
From: |
Fabiano Rosas |
Subject: |
Re: [PATCH 3/3] avocado_qemu: add AVOCADO_DEFAULT_MACHINE |
Date: |
Wed, 18 Jan 2023 12:42:47 -0300 |
Daniel Henrique Barboza <dbarboza@ventanamicro.com> writes:
> Allow users to control which machine to use in tests where no particular
> machine is specified. This is a good way to run tests in a machine
> that's not the arch default, e.g. for qemu-system-x86_64 tests can be
> run using a machine other than pc-i440fx.
>
> This env var has greater effect when used together with the recently
> added AVOCADO_DEFAULT_ARCH, allowing full control of what the tests
> should use if no default arch/machine is given. In this example, a
> check-avocado run will use the RISC-V 'virt' machine if no default
> arch/machine is set:
>
> AVOCADO_DEFAULT_ARCH=riscv64 AVOCADO_DEFAULT_MACHINE=virt make check-avocado
>
> Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
> ---
> docs/devel/testing.rst | 8 +++++---
> tests/avocado/avocado_qemu/__init__.py | 3 +++
> 2 files changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst
> index 95d0a3e626..128b6ae964 100644
> --- a/docs/devel/testing.rst
> +++ b/docs/devel/testing.rst
> @@ -1178,9 +1178,11 @@ The machine type that will be set to all QEMUMachine
> instances created
> by the test.
>
> The ``machine`` attribute will be set to the test parameter of the same
> -name. If one is not given explicitly, it will either be set to
> -``None``, or, if the test is tagged with one (and only one)
> -``:avocado: tags=machine:VALUE`` tag, it will be set to ``VALUE``.
> +name. If one is not given explicitly, an env variable
> +AVOCADO_DEFAULT_MACHINE can be used as default value if set. Otherwise
> +it will either be set to ``None``, or, if the test is tagged with one
> +(and only one) ``:avocado: tags=machine:VALUE`` tag, it will be set to
> +``VALUE``.
>
> qemu_bin
> ''''''''
> diff --git a/tests/avocado/avocado_qemu/__init__.py
> b/tests/avocado/avocado_qemu/__init__.py
> index bc42985cbb..75eaaa9265 100644
> --- a/tests/avocado/avocado_qemu/__init__.py
> +++ b/tests/avocado/avocado_qemu/__init__.py
> @@ -282,6 +282,9 @@ def setUp(self):
> self.machine = self.params.get('machine',
>
> default=self._get_unique_tag_val('machine'))
>
Would it work for you to replicate the AVOCADO_CMDLINE_TAGS behavior?
In Makefile.include:
ifdef AVOCADO_PARAMS
AVOCADO_CMDLINE_PARAMS=$(addprefix -p , $(AVOCADO_PARAMS))
endif
make V=1 check-avocado AVOCADO_PARAMS=machine=foo
AVOCADO_TESTS=../tests/avocado/migration.py
Results in:
./qemu-system-x86_64 -display none -vga none ... -machine foo