From ab66851f8492b7499bfc8a4a6cf6218f40f71798 Mon Sep 17 00:00:00 2001 From: Gal Pressman Date: Sun, 12 Jul 2020 11:10:08 +0300 Subject: [PATCH] tests: Skip tests with unsupported MR access flags The shared PD test triggers a flow that tries to create an MR through QpExRCRDMAWrite class with access flags that might not be supported on some devices, skip the test in that case. Signed-off-by: Gal Pressman --- tests/utils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/utils.py b/tests/utils.py index f92e1857e..6094081c1 100755 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,6 +4,7 @@ Provide some useful helper function for pyverbs' tests. """ from itertools import combinations as com +import errno import unittest import random import socket @@ -267,8 +268,13 @@ def create_custom_mr(agr_obj, additional_access_flags=0, size=None): :param size: MR's length. If None, agr_obj.msg_size is used. """ mr_length = size if size else agr_obj.msg_size - return MR(agr_obj.pd, mr_length, - e.IBV_ACCESS_LOCAL_WRITE | additional_access_flags) + try: + return MR(agr_obj.pd, mr_length, + e.IBV_ACCESS_LOCAL_WRITE | additional_access_flags) + except PyverbsRDMAError as ex: + if ex.error_code == errno.EOPNOTSUPP: + raise unittest.SkipTest(f'Create custom mr with additional access flags {additional_access_flags} is not supported') + raise ex # Traffic helpers