Skip to content

Commit

Permalink
WIP: use arch tags on test setup
Browse files Browse the repository at this point in the history
Not defaulting to os.uname() to set a default arch, checking for valid
archs based on the tags, and finally setting a default arch if one and
only one arch is given as a tag.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
  • Loading branch information
clebergnu committed Oct 19, 2018
1 parent 0ce31ea commit 359b8b4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
16 changes: 14 additions & 2 deletions tests/acceptance/avocado_qemu/__init__.py
Expand Up @@ -52,8 +52,20 @@ def pick_default_qemu_bin(arch=None):

class Test(avocado.Test):
def setUp(self):
self.vm = None
self.arch = self.params.get('arch', default=os.uname()[4])
arches = [tag.split(':', 1)[1] for tag in self.tags if tag.startswith('arch:')]

# Do not set a default arch based on the host - see discussion on qemu-devel
self.arch = self.params.get('arch', None)

# If a arch parameter is *not* given, and one, and only one "arch:" tag is
# given, default to that
if self.arch is None and len(arches) == 1:
self.arch = arches[0]

# If arch is still not set, cancel the test
if self.arch not in arches:
self.cancel('Currently specific to the targets: %s' % ", ".join(arches))

self.qemu_bin = self.params.get('qemu_bin',
default=pick_default_qemu_bin(self.arch))
if self.qemu_bin is None:
Expand Down
8 changes: 3 additions & 5 deletions tests/acceptance/boot_linux_console.py
Expand Up @@ -25,8 +25,9 @@ class BootLinuxConsole(Test):
timeout = 60

def test_x86_64_pc(self):
if self.arch != 'x86_64':
self.cancel('Currently specific to the x86_64 arch')
"""
:avocado: tags=arch:x86_64
"""
kernel_url = ('https://mirrors.kernel.org/fedora/releases/28/'
'Everything/x86_64/os/images/pxeboot/vmlinuz')
kernel_hash = '238e083e114c48200f80d889f7e32eeb2793e02a'
Expand Down Expand Up @@ -62,9 +63,6 @@ def test_mips_4kc_malta(self):
:avocado: tags=arch:mips
"""
if self.arch != 'mips': # FIXME use 'arch' tag in parent class?
self.cancel('Currently specific to the %s target arch' % self.arch)

deb_url = ('http://snapshot.debian.org/archive/debian/20130217T032700Z/'
'pool/main/l/linux-2.6/'
'linux-image-2.6.32-5-4kc-malta_2.6.32-48_mips.deb')
Expand Down

0 comments on commit 359b8b4

Please sign in to comment.