Skip to content

Commit

Permalink
tests: Skip mlx5 RDMACMBaseTest test from running over non mlx5 devices
Browse files Browse the repository at this point in the history
To avoid running mlx5 RDMACMBaseTest tests over non mlx5 devices, changes
the tests to inherit from a new base Mlx5RDMACMBaseTest class that will
implement the setUp() function to verify that the tested device is an
MLX5 device otherwise skip the test.

Signed-off-by: Kamal Heib <[email protected]>
  • Loading branch information
Kamalheib committed May 12, 2021
1 parent b25dd33 commit 80d03bb
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 7 additions & 1 deletion tests/mlx5_base.py
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@
from pyverbs.providers.mlx5.mlx5dv import Mlx5Context, Mlx5DVContextAttr, \
Mlx5DVQPInitAttr, Mlx5QP, Mlx5DVDCInitAttr
from tests.base import TrafficResources, set_rnr_attributes, DCT_KEY, \
RDMATestCase, PyverbsAPITestCase
RDMATestCase, PyverbsAPITestCase, RDMACMBaseTest
from pyverbs.pyverbs_error import PyverbsRDMAError, PyverbsUserError
from pyverbs.qp import QPCap, QPInitAttrEx, QPAttr
import pyverbs.providers.mlx5.mlx5_enums as dve
@@ -66,6 +66,12 @@ def setUp(self):
skip_if_not_mlx5_dev(d.Context(name=self.dev_name))


class Mlx5RDMACMBaseTest(RDMACMBaseTest):
def setUp(self):
super().setUp()
skip_if_not_mlx5_dev(d.Context(name=self.dev_name))


class Mlx5DcResources(TrafficResources):
def __init__(self, dev_name, ib_port, gid_index, send_ops_flags,
qp_count=1, create_flags=0):
5 changes: 2 additions & 3 deletions tests/test_mlx5_rdmacm.py
Original file line number Diff line number Diff line change
@@ -7,13 +7,12 @@
from pyverbs.providers.mlx5.mlx5dv import Mlx5DVQPInitAttr, Mlx5QP, \
Mlx5DVDCInitAttr, Mlx5Context
from tests.test_rdmacm import CMAsyncConnection
from tests.mlx5_base import Mlx5PyverbsAPITestCase
from tests.mlx5_base import Mlx5PyverbsAPITestCase, Mlx5RDMACMBaseTest
from pyverbs.pyverbs_error import PyverbsRDMAError
from pyverbs.srq import SRQ, SrqInitAttr, SrqAttr
import pyverbs.providers.mlx5.mlx5_enums as dve
from tests.base_rdmacm import AsyncCMResources
from pyverbs.qp import QPCap, QPInitAttrEx
from tests.base import RDMACMBaseTest
from pyverbs.cmid import ConnParam
from tests.base import DCT_KEY
from pyverbs.addr import AH
@@ -160,7 +159,7 @@ def create_conn_param(self, qp_num=0, conn_idx=0):
return ConnParam(qp_num=qp_num)


class Mlx5CMTestCase(RDMACMBaseTest):
class Mlx5CMTestCase(Mlx5RDMACMBaseTest):
"""
Mlx5 RDMACM test class.
"""

0 comments on commit 80d03bb

Please sign in to comment.