Commit graph

21 commits

Author SHA1 Message Date
Willian Rampazzo bbbd9b6ec6 tests/acceptance: rename tests acceptance to tests avocado
In the discussion about renaming the `tests/acceptance` [1], the
conclusion was that the folders inside `tests` are related to the
framework running the tests and not directly related to the type of
the tests.

This changes the folder to `tests/avocado` and adjusts the MAKEFILE, the
CI related files and the documentation.

[1] https://lists.gnu.org/archive/html/qemu-devel/2021-05/msg06553.html

Reviewed-by: Niek Linnenbank <nieklinnenbank@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Tested-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20211105155354.154864-3-willianr@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2021-11-08 17:00:22 +01:00
Cleber Rosa 9a94d8ae97 tests/acceptance/linux_ssh_mips_malta.py: drop identical setUp
These tests' setUp do not do anything beyong what their base class do.
And while they do decorate the setUp() we can decorate the classes
instead, so no functionality is lost here.

This is possible because since Avocado 76.0 we can decorate setUp()
directly.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20210415215141.1865467-4-crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
[PMD: added note to commit message about Avocado feature/version]
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2021-07-13 16:23:11 -04:00
Cleber Rosa 7edee7ad94 Acceptance Tests: move useful ssh methods to base class
Both the virtiofs submounts and the linux ssh mips malta tests
contains useful methods related to ssh that deserve to be made
available to other tests.  Let's move them to an auxiliary, mix-in
class that will be used on the base LinuxTest class.

The method that helps with setting up an ssh connection will now
support both key and password based authentication, defaulting to key
based.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20210412044644.55083-5-crosa@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-01 16:21:20 -04:00
Cleber Rosa 976218cbe7 Python: add utility function for retrieving port redirection
Slightly different versions for the same utility code are currently
present on different locations.  This unifies them all, giving
preference to the version from virtiofs_submounts.py, because of the
last tweaks added to it.

While at it, this adds a "qemu.utils" module to host the utility
function and a test.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Reviewed-by: Willian Rampazzo <willianr@redhat.com>
Message-Id: <20210412044644.55083-4-crosa@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
[Squashed in below fix. --js]
Signed-off-by: John Snow <jsnow@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20210601154546.130870-2-crosa@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
2021-06-01 16:21:20 -04:00
Cleber Rosa 4f0d032185 Acceptance tests: clarify ssh connection failure reason
If the connection to the ssh server fails, it may indeed be a "sshd"
issue, but it may also not be that.  Let's state what we know: the
establishment of the connection from the client side was not possible.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210203172357.1422425-13-crosa@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2021-02-08 17:22:36 +01:00
John Snow a0690c3900 tests/acceptance: wait() instead of shutdown() where appropriate
When issuing 'reboot' to a VM with the no-reboot option, that VM will
exit. When then issuing a shutdown command, the cleanup may race.

Add calls to vm.wait() which will gracefully mark the VM as having
exited. Subsequent vm.shutdown() calls in generic tearDown code will not
race when called after completion of the call.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Tested-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20200710050649.32434-9-jsnow@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2020-07-14 22:22:22 +02:00
Peter Maydell f6e7a97acb Python queue 2019-12-17
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEeruW64tGuU1eD+m7ZX6NM6XyCfMFAl34Y8sACgkQZX6NM6Xy
 CfOcRA/+PnbiBHQXJgbRlEUzcwUYkCrtnZYV8Lrvq8+2tiW5x1CR6f64jnap/w50
 gEUvbrkfLFG5U5OOgpPGDmcyFXM7380uj5nqQL2ZEC945YMimQaGJg/B9mV6gSkl
 Rz1y4/y58Lre5zrPAIjEkytMrMgtp0VgT6Lblp7FslxAIlpqwwDNSz2rY8VoAkob
 RnOihiuMGUrcF4WNSKPj94AS+EJZLfeJDrVpy/yadfdEs1NskeZNDkl+vGeV2M64
 qgxr/zQtKL1o58nnrj/Ro5fKYbgcoF43YhF7KbW7GfetbZmF7WagO3sp8HfDNNaH
 dzM1/9yQsOXVlRDhtu3G96N6gTVdQGYPqjlYQJpYuOizVMxzAG8OIQVn9PdYO48x
 CAXoO0FBBpI5krez6F4RaUXhHzEkhbkUZMwZyX482xNoeTnsnMvyB278/DKuYoXV
 A1CE+zLfABNn69oe1z10WpyetlJ4J4y+9MWJhqpKgY9tvFF6ZfMmlkxHPsblkOCL
 6MDZoThYYdeCot0DaX/rPT0rK+SJA6kg0sbfdGqvmBEL1LsqhWvqXuG/mxl0nHoU
 Mq+0tDdrs/6lGhShhgGo2+ceONtHiywI1oKBt/A6tVA2lmhJOipV+3d6ISnhR4kq
 pPJtbCziVv9kNvuYvmEnUGn5HzLOgYfzMoB7e9tCMS6+8lH2jd8=
 =4LJa
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cleber/tags/python-next-pull-request' into staging

Python queue 2019-12-17

# gpg: Signature made Tue 17 Dec 2019 05:12:43 GMT
# gpg:                using RSA key 7ABB96EB8B46B94D5E0FE9BB657E8D33A5F209F3
# gpg: Good signature from "Cleber Rosa <crosa@redhat.com>" [marginal]
# gpg: WARNING: This key is not certified with sufficiently trusted signatures!
# gpg:          It is not certain that the signature belongs to the owner.
# Primary key fingerprint: 7ABB 96EB 8B46 B94D 5E0F  E9BB 657E 8D33 A5F2 09F3

* remotes/cleber/tags/python-next-pull-request:
  python/qemu: Remove unneeded imports in __init__
  python/qemu: accel: Add tcg_available() method
  python/qemu: accel: Strengthen kvm_available() checks
  python/qemu: accel: Add list_accel() method
  python/qemu: Move kvm_available() to its own module
  Acceptance tests: use relative location for tests
  Acceptance tests: use avocado tags for machine type
  Acceptance tests: introduce utility method for tags unique vals
  Acceptance test x86_cpu_model_versions: use default vm
  tests/acceptance: Makes linux_initrd and empty_cpu_model use QEMUMachine
  python/qemu: Add set_qmp_monitor() to QEMUMachine
  analyze-migration.py: replace numpy with python 3.2
  analyze-migration.py: fix find() type error
  Revert "Acceptance test: cancel test if m68k kernel packages goes missing"
  tests/boot_linux_console: Fetch assets from Debian snapshot archives

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2019-12-17 14:34:31 +00:00
Cleber Rosa ba21bde930 Acceptance tests: use avocado tags for machine type
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>
2019-12-16 11:23:19 -05:00
Filip Bozuta dbd07eda9d mips: malta: Renovate coding style
The script checkpatch.pl located in scripts folder was
used to detect all errors and warrnings in files:
    hw/mips/mips_malta.c
    hw/mips/gt64xxx_pci.c
    tests/acceptance/linux_ssh_mips_malta.py

All these mips malta machine files were edited and
all the errors and warrings generated by the checkpatch.pl
script were corrected and then the script was
ran again to make sure there are no more errors and warnings.

Signed-off-by: Filip Bozuta <Filip.Bozuta@rt-rk.com>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <1575640687-20744-3-git-send-email-Filip.Bozuta@rt-rk.com>
2019-12-16 13:08:17 +01:00
Cleber Rosa 77bcd2487e Acceptance tests: refactor wait_for_console_pattern
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>
2019-10-28 19:04:04 -04:00
Philippe Mathieu-Daudé 220ad858d3 tests/ssh_linux_malta: Fix 64-bit target tests
Commit 9090d3332c added tests for specific to the 32-bit
machines, which inadvertently make the 64-bit tests failing.
Now than we have this information available in the CPU_INFO
array, use it to have the 64-bit tests back.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <20191019153437.9820-12-f4bug@amsat.org>
2019-10-25 18:37:01 +02:00
Philippe Mathieu-Daudé a7b198ed7d tests/ssh_linux_malta: Refactor how to get image/kernel info
The qcow and kernel images use a similar pattern regarding they
are for big/little endianess, or 32/64 bit.
Refactor using more dictionary keys.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <20191019153437.9820-11-f4bug@amsat.org>
2019-10-25 18:37:01 +02:00
Philippe Mathieu-Daudé 848149ad59 tests/ssh_linux_malta: Match stricter console output
Match on stricter console output.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <20191019153437.9820-10-f4bug@amsat.org>
2019-10-25 18:37:01 +02:00
Philippe Mathieu-Daudé c91839ffa8 tests/ssh_linux_malta: Remove duplicated test
Remove duplicated test (probably copy/paste error in
commit 9090d3332c).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <20191019153437.9820-9-f4bug@amsat.org>
2019-10-25 18:37:01 +02:00
Philippe Mathieu-Daudé b1c4521680 tests/ssh_linux_malta: Run tests using a snapshot image
If a test fails, it can corrupt the underlying QCow2 image,
making further tests failing.
Fix this by running each test with a snapshot.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <20191019153437.9820-8-f4bug@amsat.org>
2019-10-25 18:37:01 +02:00
Cleber Rosa 2fe6f4d9ba Acceptance tests: use avocado.utils.ssh for SSH interaction
This replaces paramiko with avocado.utils.ssh module, which is based
on a (open)ssh binary, supposedly more ubiquitous.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190919225905.10829-1-crosa@redhat.com>
[Cleber: consolidated existing skipUnless from tests to setUp]
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2019-09-20 17:13:41 -04:00
Aleksandar Markovic 9090d3332c tests/acceptance: Add new test cases in linux_ssh_mips_malta.py
Add 15 new tests cases. They all rely on simple commands used for
detecting hardware configuration information.

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <1564760158-27536-3-git-send-email-aleksandar.markovic@rt-rk.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2019-09-20 17:04:16 -04:00
Aleksandar Markovic 07d647b261 tests/acceptance: Refactor and improve reporting in linux_ssh_mips_malta.py
This patch restructures code organization around the test case
executions. At the same time, rather than outputing a cryptic message:

FAIL: True not found in [False],

the following will be reported too, if the command output does not meet
specified expectations:

'lspci -d 11ab:4620' output doesn't contain the word 'GT-64120'

Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Message-Id: <1564760158-27536-2-git-send-email-aleksandar.markovic@rt-rk.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2019-09-20 17:04:03 -04:00
Philippe Mathieu-Daudé 471c97a693 BootLinuxSshTest: Only run the tests when explicitly requested
Currently the Avocado framework does not distinct the time spent
downloading assets vs. the time spent running a test. With big
assets (like a full VM image) the tests likely fail.

This is a limitation known by the Avocado team.
Until this issue get fixed, do not run this tests automatically.

Tests can still be run setting the AVOCADO_TIMEOUT_EXPECTED
environment variable.

Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Reported-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Message-Id: <20190918122748.2144-1-philmd@redhat.com>
Signed-off-by: Cleber Rosa <crosa@redhat.com>
2019-09-19 09:53:39 -04:00
Philippe Mathieu-Daudé 73a5a775d2 BootLinuxSshTest: Only use 'test' for unittest.TestCase method names
In commit f6e501a28e, Eduardo started to use "check_" as a
prefix for methods of similar purpose. Follow this prior art,
since it might become the conventions when writting Avocado
tests.

Suggested-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190607174953.22342-1-philmd@redhat.com>
Reviewed-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
2019-08-27 16:57:15 -03:00
Philippe Mathieu-Daudé c47c336e87 BootLinuxSshTest: Test some userspace commands on Malta
This tests boot a full VM and check the serial console until
the SSH daemon is running, then start a SSH session and run
some commands.

This test can be run using:

  $ avocado --show=ssh run -t arch:mips tests/acceptance/linux_ssh_mips_malta.py
  ssh: Entering interactive session.
  ssh: # uname -a
  ssh: Linux debian-mips 3.2.0-4-4kc-malta #1 Debian 3.2.51-1 mips GNU/Linux
  ssh: # lspci -d 11ab:4620
  ssh: 00:00.0 Host bridge: Marvell Technology Group Ltd. GT-64120/64120A/64121A System Controller (rev 10)
  ssh: # cat /sys/bus/i2c/devices/i2c-0/name
  ssh: SMBus PIIX4 adapter at 1100
  ssh: # cat /proc/mtd
  ssh: dev:    size   erasesize  name
  ssh: mtd0: 00100000 00010000 "YAMON"
  ssh: mtd1: 002e0000 00010000 "User FS"
  ssh: mtd2: 00020000 00010000 "Board Config"
  ssh: # md5sum /dev/mtd2ro
  ssh: 0dfbe8aa4c20b52e1b8bf3cb6cbdf193  /dev/mtd2ro
  ssh: # poweroff

Acked-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Aleksandar Markovic <amarkovic@wavecomp.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Message-Id: <20190523161832.22490-5-f4bug@amsat.org>
2019-05-26 17:45:02 +02:00