diff mbox series

[V1,4/5] framework/test_case: add skip_unsupported_host_driver decorator

Message ID 20221130080439.65529-5-linglix.chen@intel.com (mailing list archive)
State Superseded
Headers show
Series use decorator to skip igb_uio cases | expand

Commit Message

Lingli Chen Nov. 30, 2022, 8:04 a.m. UTC
Signed-off-by: Lingli Chen <linglix.chen@intel.com>
---
 framework/test_case.py | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
diff mbox series

Patch

diff --git a/framework/test_case.py b/framework/test_case.py
index 2831cb36..88a60db7 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -606,3 +606,23 @@  def check_supported_nic(nics):
         return wrapper
 
     return decorator
+
+
+def skip_unsupported_host_driver(drivers):
+    """
+    Skip case which are not supported by the host driver(vfio-pci/igb_uio etc.)
+    """
+    if isinstance(drivers, str):
+        drivers = [drivers]
+
+    def decorator(func):
+        @wraps(func)
+        def wrapper(*args, **kwargs):
+            test_case = args[0]
+            if test_case.drivername in drivers:
+                raise VerifySkip("{} do not support this case".format(test_case.drivername))
+            return func(*args, **kwargs)
+
+        return wrapper
+
+    return decorator