aboutsummaryrefslogtreecommitdiff
path: root/tests/atf_python/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/atf_python/utils.py')
-rw-r--r--tests/atf_python/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/atf_python/utils.py b/tests/atf_python/utils.py
index 4bd4b642b131..26911c12aef3 100644
--- a/tests/atf_python/utils.py
+++ b/tests/atf_python/utils.py
@@ -46,6 +46,7 @@ class BaseTest(object):
NEED_ROOT: bool = False # True if the class needs root privileges for the setup
TARGET_USER = None # Set to the target user by the framework
REQUIRED_MODULES: List[str] = []
+ SKIP_MODULES: List[str] = []
def require_module(self, mod_name: str, skip=True):
error_code = libc.modfind(mod_name)
@@ -58,9 +59,18 @@ class BaseTest(object):
else:
raise ValueError(txt)
+ def skip_module(self, mod_name: str):
+ error_code = libc.modfind(mod_name)
+ if error_code == 0:
+ txt = "kernel module '{}' loaded, skip test".format(mod_name)
+ pytest.skip(txt)
+ return
+
def _check_modules(self):
for mod_name in self.REQUIRED_MODULES:
self.require_module(mod_name)
+ for mod_name in self.SKIP_MODULES:
+ self.skip_module(mod_name)
@property
def atf_vars(self) -> Dict[str, str]: