tests/functional: switch to new test skip decorators

This ensures consistency of behaviour across all the tests, and requires
that we provide gitlab bug links when marking a test to be skipped due
to unreliability.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20241217155953.3950506-9-berrange@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
Daniel P. Berrangé 2024-12-17 15:59:29 +00:00 committed by Thomas Huth
parent 3ea06d65be
commit 3d5938607e
16 changed files with 61 additions and 122 deletions

View file

@ -32,7 +32,6 @@ https://gitlab.com/qemu-project/biosbits-bits .
"""
import os
import platform
import re
import shutil
import subprocess
@ -46,28 +45,13 @@ from typing import (
Sequence,
)
from qemu.machine import QEMUMachine
from unittest import skipIf
from qemu_test import QemuSystemTest, Asset, which
from qemu_test import (QemuSystemTest, Asset, skipIfMissingCommands,
skipIfNotMachine)
deps = ["xorriso", "mformat"] # dependent tools needed in the test setup/box.
supported_platforms = ['x86_64'] # supported test platforms.
# default timeout of 120 secs is sometimes not enough for bits test.
BITS_TIMEOUT = 200
def missing_deps():
""" returns True if any of the test dependent tools are absent.
"""
for dep in deps:
if which(dep) is None:
return True
return False
def supported_platform():
""" checks if the test is running on a supported platform.
"""
return platform.machine() in supported_platforms
class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods
"""
A QEMU VM, with isa-debugcon enabled and bits iso passed
@ -110,9 +94,8 @@ class QEMUBitsMachine(QEMUMachine): # pylint: disable=too-few-public-methods
"""return the base argument to QEMU binary"""
return self._base_args
@skipIf(not supported_platform() or missing_deps(),
'unsupported platform or dependencies (%s) not installed' \
% ','.join(deps))
@skipIfMissingCommands("xorriso", "mformat")
@skipIfNotMachine("x86_64")
class AcpiBitsTest(QemuSystemTest): #pylint: disable=too-many-instance-attributes
"""
ACPI and SMBIOS tests using biosbits.