[dts][PATCH V2 4/5] framework/test_case: add skip_unsupported_host_driver decorator

Lingli Chen linglix.chen at intel.com
Fri Dec 9 08:08:06 CET 2022


add decorator

Signed-off-by: Lingli Chen <linglix.chen at intel.com>
---
V2: reformat framework/test_case.py

 framework/test_case.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/framework/test_case.py b/framework/test_case.py
index 2831cb36..86f5bbbf 100644
--- a/framework/test_case.py
+++ b/framework/test_case.py
@@ -606,3 +606,25 @@ 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
-- 
2.17.1



More information about the dts mailing list