summaryrefslogtreecommitdiffstats
path: root/tests/acceptance/avocado_qemu
Commit message (Collapse)AuthorAgeFilesLines
* tests/acceptance: Add Test.fetch_asset(cancel_on_missing=True)Philippe Mathieu-Daudé2020-09-101-0/+12
| | | | | | | | | | | Invert the default of avocado.Test.fetch_asset 'cancel_on_missing' keyword: accept missing artefacts by default. If a test is certain an artifact can't be missing, it will set cancel_on_missing=False. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Alex Bennée <alex.bennee@linaro.org> Message-Id: <20200908202352.298506-3-philmd@redhat.com> Message-Id: <20200909112742.25730-10-alex.bennee@linaro.org>
* meson: link emulators without Makefile.targetPaolo Bonzini2020-08-211-2/+1Star
| | | | | | | | The binaries move to the root directory, e.g. qemu-system-i386 or qemu-arm. This requires changes to qtests, CI, etc. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* tests/acceptance: allow console interaction with specific VMsPavel Dovgalyuk2020-05-311-5/+8
| | | | | | | | | | | | | | Console interaction in avocado scripts was possible only with single default VM. This patch modifies the function parameters to allow passing a specific VM as a parameter to interact with it. Signed-off-by: Pavel Dovgalyuk <Pavel.Dovgaluk@ispras.ru> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Reviewed-by: Alex Bennée <alex.bennee@linaro.org> Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <159073587933.20809.5122618715976660635.stgit@pasha-ThinkPad-X280> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
* Acceptance tests: introduce BUILD_DIR and SOURCE_DIRCleber Rosa2020-03-171-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | Some tests may benefit from using resources from a build directory. This introduces three variables that can help tests find resources in those directories. First, a BUILD_DIR is assumed to exist, given that the primary form of running the acceptance tests is from a build directory (which may or may not be the same as the source tree, that is, the SOURCE_DIR). If the directory containing the acceptance tests happens to be a link to a directory, it's assumed to it points to the source tree (SOURCE_DIR), which is the behavior defined on the QEMU Makefiles. If the directory containing the acceptance tests is not a link, then a in-tree build is assumed, and the BUILD_DIR and SOURCE_DIR have the same value. Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Tested-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Tested-by: Willian Rampazzo <willianr@redhat.com> Message-Id: <20200317141654.29355-2-crosa@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* Acceptance tests: Add interrupt_interactive_console_until_pattern()Philippe Mathieu-Daudé2020-02-071-2/+30
| | | | | | | | | | | | | | We need a function to interrupt interactive consoles. Example: Interrupt U-Boot to set different environment values. Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Tested-by: Liam Merwick <liam.merwick@oracle.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20200120235159.18510-4-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
* Acceptance tests: Extract _console_interaction()Philippe Mathieu-Daudé2020-02-071-14/+17
| | | | | | | | | | | | | | Since we are going to re-use the code shared between wait_for_console_pattern() and exec_command_and_wait_for_pattern(), extract the common part into a local function. Tested-by: Niek Linnenbank <nieklinnenbank@gmail.com> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Liam Merwick <liam.merwick@oracle.com> Tested-by: Liam Merwick <liam.merwick@oracle.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20200120235159.18510-3-f4bug@amsat.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
* Acceptance tests: use avocado tags for machine typeCleber Rosa2019-12-161-0/+5
| | | | | | | | | | | | | | The same way the arch tag is being used as a fallback for the arch parameter, let's do the same for QEMU's machine and avoid some boiler plate code. This is now possible because, since Avocado 72.0, it's possible to use tags with names that match the machine types on QEMU. Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20191104151323.9883-4-crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* Acceptance tests: introduce utility method for tags unique valsCleber Rosa2019-12-161-6/+13
| | | | | | | | | | | | | | | Currently a test can describe the target architecture binary that it should primarily be run with, be setting a single tag value. The same approach is expected to be done with other QEMU aspects to be tested, for instance, the machine type and accelerator, so let's generalize the logic into a utility method. Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20190924194501.9303-3-crosa@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* tests/acceptance: Refactor exec_command_and_wait_for_pattern()Philippe Mathieu-Daudé2019-10-291-0/+19
| | | | | | | | | | | Refactor the exec_command_and_wait_for_pattern() utility method so we can reuse it in other files. Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191028073441.6448-6-philmd@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Tested-by: Cleber Rosa <crosa@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* tests/acceptance: Fix wait_for_console_pattern() hangsPhilippe Mathieu-Daudé2019-10-291-0/+1
| | | | | | | | | | | | | | Because of a possible deadlock (QEMU waiting for the socket to become writable) let's close the console socket as soon as we stop to use it. Suggested-by: Cleber Rosa <crosa@redhat.com> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Message-Id: <20191028073441.6448-4-philmd@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> [Cleber: corrected small typo in commit message] Signed-off-by: Cleber Rosa <crosa@redhat.com>
* Acceptance tests: refactor wait_for_console_patternCleber Rosa2019-10-291-0/+25
| | | | | | | | | | | | | | | The same utility method is already present in two different test files, so let's consolidate it into a single utility function. Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20190916164011.7653-1-crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> [PMD: failure_message is optional] Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com> Message-Id: <20191028073441.6448-3-philmd@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* Acceptance tests: work around socket dirCleber Rosa2019-10-291-1/+2
| | | | | | | | | | | | Change 32558ce7a4 introduced specific directories for the socket dir when using python/qemu/machine.py:QEMUMachine. iotests probably didn't catch the condition that two simultaneous QEMUMachine instances, without manually set temporary or socket dirs would clash. Having two QEMUMachine instances is a condition expected for many acceptance tests, and it's already used by the migration tests. Signed-off-by: Cleber Rosa <crosa@redhat.com>
* tests.acceptance.avocado_qemu: Add support for powerpcSatheesh Rajendran2019-08-291-0/+3
| | | | | | | | | | | | | | Current acceptance test will not run properly in powerpc environment due qemu target is different from arch, this usually matches, except with bi-endian architectures like ppc64. uname would return `ppc64` or `ppc64le` based `big` or `little` endian but qemu `target` is always `ppc64`. Let's handle it. Reviewed-by: Cédric Le Goater <clg@kaod.org> Signed-off-by: Satheesh Rajendran <sathnaga@linux.vnet.ibm.com> Message-Id: <20190819082820.14817-1-sathnaga@linux.vnet.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* python/qemu: split QEMUMachine out from underneath __init__.pyJohn Snow2019-07-021-1/+1
| | | | | | | | | | | | It's not obvious that something named __init__.py actually houses important code that isn't relevant to python packaging glue. Move the QEMUMachine and related error classes out into their own module. Adjust users to the new import location. Signed-off-by: John Snow <jsnow@redhat.com> Message-Id: <20190627212816.27298-2-jsnow@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* tests/acceptance: look for target architecture in test tags firstCleber Rosa2019-05-031-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <crosa@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20190312171824.5134-7-crosa@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* tests/acceptance: introduce arch parameter and attributeCleber Rosa2019-05-031-3/+11
| | | | | | | | | | | | | | | | | | | | | 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 <crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20190312171824.5134-5-crosa@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* tests/acceptance: improve docstring on pick_default_qemu_bin()Cleber Rosa2019-05-031-0/+4
| | | | | | | | | | | Making it clear what is returned by this utility function. Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Caio Carrara <ccarrara@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Cornelia Huck <cohuck@redhat.com> Message-Id: <20190312171824.5134-3-crosa@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
* tests.acceptance: adds multi vm capability for acceptance testsCaio Carrara2019-02-221-4/+21
| | | | | | | | | | | | | | | | | | | | | | This change adds the possibility to write acceptance tests with multi virtual machine support. It's done keeping the virtual machines objects stored in a test attribute (dictionary). This dictionary shouldn't be accessed directly but through the new method added `get_vm`. This new method accept a list of args (that will be added as virtual machine arguments) and an optional name argument. The name is the key that identify a single virtual machine along the test machines available. If a name without a machine is informed a new machine will be instantiated. The current usage of vm in tests will not be broken by this change since it keeps a property called vm in the base test class. This property only calls the new method `get_vm` with default parameters (no args and 'default' as machine name). Signed-off-by: Caio Carrara <ccarrara@redhat.com> Reviewed-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com> Message-Id: <20190212193855.13223-2-ccarrara@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* Introduce a Python module structureCleber Rosa2019-02-221-3/+2Star
| | | | | | | | | | | | | | | | | | This is a simple move of Python code that wraps common QEMU functionality, and are used by a number of different tests and scripts. By treating that code as a real Python module, we can more easily: * reuse code * have a proper place for the module's own unittests * apply a more consistent style * generate documentation Signed-off-by: Cleber Rosa <crosa@redhat.com> Reviewed-by: Caio Carrara <ccarrara@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-Id: <20190206162901.19082-2-crosa@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
* Add functional/acceptance tests infrastructureCleber Rosa2018-06-151-0/+54
This patch adds the very minimum infrastructure necessary for writing and running functional/acceptance tests, including: * Documentation * The avocado_qemu.Test base test class * One example tests (version.py) Additional functionality is expected to be added along the tests that require them. Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20180530184156.15634-2-crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Tested-by: Philippe Mathieu-Daudé <f4bug@amsat.org> [ehabkost: fix typo on testing.rst] Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>