aboutsummaryrefslogtreecommitdiff
path: root/tests/acceptance/avocado_qemu
diff options
context:
space:
mode:
authorCleber Rosa <crosa@redhat.com>2021-04-14 18:14:57 -0400
committerCleber Rosa <crosa@redhat.com>2021-07-13 13:18:50 -0400
commitd5adf9d52b36d63347b2f658b8c67567ff6bd525 (patch)
tree6afe8060b0298120991033dd7ea1230d91319ace /tests/acceptance/avocado_qemu
parent889554f09ed0d4c2fcc6be28b81e2e9fc8f35aee (diff)
Acceptance Tests: support choosing specific distro and version
The tests based on the LinuxTest class give the test writer a ready to use guest operating system, currently pinned to Fedora 31. With this change, it's now possible to choose different distros and versions, similar to how other tags and parameter can be set for the target arch, accelerator, etc. One of the reasons for this work, is that some development features depend on updates on the guest side. For instance the tests on virtiofs_submounts.py, require newer kernels, and may benefit from running, say on Fedora 34, without the need for a custom kernel. Please notice that the pre-caching of the Fedora 31 images done during the early stages of `make check-acceptance` (before the tests are actually executed) are not expanded here to cover every new image added. But, the tests will download other needed images (and cache them) during the first execution. Signed-off-by: Cleber Rosa <crosa@redhat.com> Message-Id: <20210414221457.1653745-4-crosa@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Reviewed-by: Willian Rampazzo <willianr@redhat.com> Signed-off-by: Cleber Rosa <crosa@redhat.com>
Diffstat (limited to 'tests/acceptance/avocado_qemu')
-rw-r--r--tests/acceptance/avocado_qemu/__init__.py47
1 files changed, 37 insertions, 10 deletions
diff --git a/tests/acceptance/avocado_qemu/__init__.py b/tests/acceptance/avocado_qemu/__init__.py
index 3a144cded4..1f1728ab83 100644
--- a/tests/acceptance/avocado_qemu/__init__.py
+++ b/tests/acceptance/avocado_qemu/__init__.py
@@ -345,8 +345,39 @@ class LinuxTest(Test, LinuxSSHMixIn):
username = 'root'
password = 'password'
+ def _set_distro(self):
+ distro = self.params.get(
+ 'distro',
+ default=self._get_unique_tag_val('distro'))
+ if not distro:
+ distro = 'fedora'
+ self.distro = distro
+
+ distro_version = self.params.get(
+ 'distro_version',
+ default=self._get_unique_tag_val('distro_version'))
+ if not distro_version:
+ distro_version = '31'
+ self.distro_version = distro_version
+
+ # The distro checksum behaves differently than distro name and
+ # version. First, it does not respect a tag with the same
+ # name, given that it's not expected to be used for filtering
+ # (distro name versions are the natural choice). Second, the
+ # order of precedence is: parameter, attribute and then value
+ # from KNOWN_DISTROS.
+ distro_checksum = self.params.get('distro_checksum',
+ default=self.distro_checksum)
+ if not distro_checksum:
+ distro_checksum = get_known_distro_checksum(self.distro,
+ self.distro_version,
+ self.arch)
+ if distro_checksum:
+ self.distro_checksum = distro_checksum
+
def setUp(self, ssh_pubkey=None, network_device_type='virtio-net'):
super(LinuxTest, self).setUp()
+ self._set_distro()
self.vm.add_args('-smp', '2')
self.vm.add_args('-m', '1024')
# The following network device allows for SSH connections
@@ -382,20 +413,16 @@ class LinuxTest(Test, LinuxSSHMixIn):
vmimage.QEMU_IMG = qemu_img
self.log.info('Downloading/preparing boot image')
- distro = 'fedora'
- distro_version = '31'
- known_distro_checksum = get_known_distro_checksum(distro,
- distro_version,
- self.arch)
- distro_checksum = self.distro_checksum or known_distro_checksum
# Fedora 31 only provides ppc64le images
image_arch = self.arch
- if image_arch == 'ppc64':
- image_arch = 'ppc64le'
+ if self.distro == 'fedora':
+ if image_arch == 'ppc64':
+ image_arch = 'ppc64le'
+
try:
boot = vmimage.get(
- distro, arch=image_arch, version=distro_version,
- checksum=distro_checksum,
+ self.distro, arch=image_arch, version=self.distro_version,
+ checksum=self.distro_checksum,
algorithm='sha256',
cache_dir=self.cache_dirs[0],
snapshot_dir=self.workdir)