diff mbox series

[2/2] tests/avocado: Allow passing command line parameters via Makefile

Message ID 20230120221500.4194-3-farosas@suse.de (mailing list archive)
State New, archived
Headers show
Series tests/avocado: Pass parameters via Makefile | expand

Commit Message

Fabiano Rosas Jan. 20, 2023, 10:15 p.m. UTC
Add support for the 'avocado run' "-p" option, which allows us to pass
parameters in the form key=value to be applied to all tests selected
for a given run. This is useful to force generic tests to use a
specific machine, cpu or qemu-binary where otherwise the defaults
would be used.

E.g.:
 $ make check-avocado AVOCADO_PARAMS="machine=virt arch=riscv64"

 <runs all tests replacing machine and arch in those that do not have
  these parameters already set via tags>

Signed-off-by: Fabiano Rosas <farosas@suse.de>
---
 tests/Makefile.include | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Daniel Henrique Barboza Feb. 2, 2023, 12:05 p.m. UTC | #1
On 1/20/23 19:15, Fabiano Rosas wrote:
> Add support for the 'avocado run' "-p" option, which allows us to pass
> parameters in the form key=value to be applied to all tests selected
> for a given run. This is useful to force generic tests to use a
> specific machine, cpu or qemu-binary where otherwise the defaults
> would be used.
> 
> E.g.:
>   $ make check-avocado AVOCADO_PARAMS="machine=virt arch=riscv64"
> 
>   <runs all tests replacing machine and arch in those that do not have
>    these parameters already set via tags>
> 
> Signed-off-by: Fabiano Rosas <farosas@suse.de>
> ---

Reviewed-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>

>   tests/Makefile.include | 6 +++++-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/tests/Makefile.include b/tests/Makefile.include
> index 9422ddaece..f92e730aa0 100644
> --- a/tests/Makefile.include
> +++ b/tests/Makefile.include
> @@ -107,6 +107,10 @@ else
>   	AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS))
>   endif
>   
> +ifdef AVOCADO_PARAMS
> +	AVOCADO_CMDLINE_PARAMS=$(addprefix -p , $(AVOCADO_PARAMS))
> +endif
> +
>   quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
>       $(TESTS_PYTHON) -m pip -q --disable-pip-version-check $1, \
>       "VENVPIP","$1")
> @@ -144,7 +148,7 @@ check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
>               --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
>               $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \
>   			--filter-by-tags-include-empty-key) \
> -            $(AVOCADO_CMDLINE_TAGS) \
> +            $(AVOCADO_CMDLINE_TAGS) $(AVOCADO_CMDLINE_PARAMS) \
>               $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
>               "AVOCADO", "tests/avocado")
>
diff mbox series

Patch

diff --git a/tests/Makefile.include b/tests/Makefile.include
index 9422ddaece..f92e730aa0 100644
--- a/tests/Makefile.include
+++ b/tests/Makefile.include
@@ -107,6 +107,10 @@  else
 	AVOCADO_CMDLINE_TAGS=$(addprefix -t , $(AVOCADO_TAGS))
 endif
 
+ifdef AVOCADO_PARAMS
+	AVOCADO_CMDLINE_PARAMS=$(addprefix -p , $(AVOCADO_PARAMS))
+endif
+
 quiet-venv-pip = $(quiet-@)$(call quiet-command-run, \
     $(TESTS_PYTHON) -m pip -q --disable-pip-version-check $1, \
     "VENVPIP","$1")
@@ -144,7 +148,7 @@  check-avocado: check-venv $(TESTS_RESULTS_DIR) get-vm-images
             --show=$(AVOCADO_SHOW) run --job-results-dir=$(TESTS_RESULTS_DIR) \
             $(if $(AVOCADO_TAGS),, --filter-by-tags-include-empty \
 			--filter-by-tags-include-empty-key) \
-            $(AVOCADO_CMDLINE_TAGS) \
+            $(AVOCADO_CMDLINE_TAGS) $(AVOCADO_CMDLINE_PARAMS) \
             $(if $(GITLAB_CI),,--failfast) $(AVOCADO_TESTS), \
             "AVOCADO", "tests/avocado")