From 805fac5272825be4a241d028a4ac02d47355b891 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:07 -0400 Subject: tests/acceptance: fix doc reference to avocado_qemu directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The "this directory" reference is misleading and confusing, it's a leftover from when this text was proposed in a README file inside the "tests/acceptance/avocado_qemu" directory. When that text was moved to the top level docs directory, the reference was not updated. Signed-off-by: Cleber Rosa Reviewed-by: Caio Carrara Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-4-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- docs/devel/testing.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'docs/devel') diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 60f897d..7c1b199 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -590,8 +590,9 @@ Alternatively, follow the instructions on this link: Overview -------- -This directory provides the ``avocado_qemu`` Python module, containing -the ``avocado_qemu.Test`` class. Here's a simple usage example: +The ``tests/acceptance/avocado_qemu`` directory provides the +``avocado_qemu`` Python module, containing the ``avocado_qemu.Test`` +class. Here's a simple usage example: .. code:: -- cgit v1.1 From 2c44d68f2b004e41136996fef0e4122e6507ba90 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:08 -0400 Subject: tests/acceptance: introduce arch parameter and attribute MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's useful to define the architecture that should be used in situations such as: * the intended target of the QEMU binary to be used on tests * the architecture of code to be run within the QEMU binary, such as a kernel image or a full blown guest OS image This commit introduces both a test parameter and a test instance attribute, that will contain such a value. Now, when the "arch" test parameter is given, it will influence the selection of the default QEMU binary, if one is not given explicitly by means of the "qemu_img" parameter. Signed-off-by: Cleber Rosa Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-5-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- docs/devel/testing.rst | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'docs/devel') diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 7c1b199..83bf9f0 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -727,6 +727,21 @@ vm A QEMUMachine instance, initially configured according to the given ``qemu_bin`` parameter. +arch +~~~~ + +The architecture can be used on different levels of the stack, e.g. by +the framework or by the test itself. At the framework level, it will +currently influence the selection of a QEMU binary (when one is not +explicitly given). + +Tests are also free to use this attribute value, for their own needs. +A test may, for instance, use the same value when selecting the +architecture of a kernel or disk image to boot a VM with. + +The ``arch`` attribute will be set to the test parameter of the same +name, and if one is not given explicitly, it will be set to ``None``. + qemu_bin ~~~~~~~~ @@ -749,6 +764,19 @@ 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 influence the selection of a QEMU binary +(when one is not explicitly given). + +Tests are also free to use this parameter value, for their own needs. +A test may, for instance, use the same value when selecting the +architecture of a kernel or disk image to boot a VM with. + +This parameter has a direct relation with the ``arch`` attribute. If +not given, it will default to None. + qemu_bin ~~~~~~~~ -- cgit v1.1 From b910545fbf3f55f22545c202c1aee62598edb838 Mon Sep 17 00:00:00 2001 From: Cleber Rosa Date: Tue, 12 Mar 2019 13:18:10 -0400 Subject: tests/acceptance: look for target architecture in test tags first A test can, optionally, be tagged for one or many architectures. If a test has been tagged for a single architecture, there's a high chance that the test won't run on other architectures. This changes the default order of choosing a default target architecture to use based on the 'arch' tag value first. The precedence order is for choosing a QEMU binary to use for a test is now: * qemu_bin parameter * arch parameter * arch tag value (for example, x86_64 if ":avocado: tags=arch:x86_64 is used) This means that if one runs: $ avocado run -p qemu_bin=/usr/bin/qemu-system-x86_64 test.py No arch parameter or tag will influence the selection of the QEMU target binary. If one runs: $ avocado run -p arch=ppc64 test.py The target binary selection mechanism will attempt to find a binary such as "ppc64-softmmu/qemu-system-ppc64". And finally, if one runs a test that is tagged (in its docstring) with "arch:aarch64": $ avocado run aarch64.py The target binary selection mechanism will attempt to find a binary such as "aarch64-softmmu/qemu-system-aarch64". At this time, no provision is made to cancel the execution of tests if the arch parameter given (manually) does not match the test "arch" tag, but it may be a useful default behavior to be added in the future. Signed-off-by: Cleber Rosa Reviewed-by: Cornelia Huck Message-Id: <20190312171824.5134-7-crosa@redhat.com> Signed-off-by: Eduardo Habkost --- docs/devel/testing.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'docs/devel') diff --git a/docs/devel/testing.rst b/docs/devel/testing.rst index 83bf9f0..da2d0fc 100644 --- a/docs/devel/testing.rst +++ b/docs/devel/testing.rst @@ -740,7 +740,9 @@ A test may, for instance, use the same value when selecting the architecture of a kernel or disk image to boot a VM with. The ``arch`` attribute will be set to the test parameter of the same -name, and if one is not given explicitly, it will be set to ``None``. +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=arch:VALUE`` tag, it will be set to ``VALUE``. qemu_bin ~~~~~~~~ -- cgit v1.1