diff mbox series

[rdma-core,10/14] tests: Add ODP RC test

Message ID 20190819065827.26921-11-noaos@mellanox.com (mailing list archive)
State Not Applicable
Headers show
Series rdma-core tests infrastructure | expand

Commit Message

Noa Osherovich Aug. 19, 2019, 6:58 a.m. UTC
From: Maxim Chicherin <maximc@mellanox.com>

Add a TestCase for ODP/RC traffic.

Signed-off-by: Maxim Chicherin <maximc@mellanox.com>
Signed-off-by: Noa Osherovich <noaos@mellanox.com>
---
 tests/CMakeLists.txt |  1 +
 tests/test_odp.py    | 30 ++++++++++++++++++++++++++++++
 2 files changed, 31 insertions(+)
 create mode 100644 tests/test_odp.py
diff mbox series

Patch

diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index f1ba542fab90..6f3c23cd1ec0 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -10,5 +10,6 @@  rdma_python_test(tests
   test_mr.py
   test_pd.py
   test_qp.py
+  test_odp.py
   utils.py
   )
diff --git a/tests/test_odp.py b/tests/test_odp.py
new file mode 100644
index 000000000000..a9f3bf4573a5
--- /dev/null
+++ b/tests/test_odp.py
@@ -0,0 +1,30 @@ 
+from tests.base import RDMATestCase
+from tests.utils import requires_odp, traffic
+from tests.base import RCResources
+from pyverbs.mr import MR
+import pyverbs.enums as e
+
+
+class OdpRC(RCResources):
+    @requires_odp('rc')
+    def create_mr(self):
+        self.mr = MR(self.pd, self.msg_size,
+                     e.IBV_ACCESS_LOCAL_WRITE | e.IBV_ACCESS_ON_DEMAND)
+
+
+class OdpTestCase(RDMATestCase):
+    def setUp(self):
+        super(OdpTestCase, self).setUp()
+        self.iters = 100
+        self.qp_dict = {'rc': OdpRC}
+
+    def create_players(self, qp_type):
+        client = self.qp_dict[qp_type](self.dev_name, self.ib_port, self.gid_index)
+        server = self.qp_dict[qp_type](self.dev_name, self.ib_port, self.gid_index)
+        client.pre_run(server.psn, server.qpn)
+        server.pre_run(client.psn, client.qpn)
+        return client, server
+
+    def test_odp_rc_traffic(self):
+        client, server = self.create_players('rc')
+        traffic(client, server, self.iters, self.gid_index, self.ib_port)