Пример #1
0
 def test_create_cq_ex_bad_flow(self):
     """
     Test ibv_create_cq_ex() with wrong comp_vector / number of cqes
     """
     for ctx, attr, attr_ex in self.devices:
         for i in range(10):
             cq_attrs_ex = CqInitAttrEx(cqe=0, wc_flags=0, comp_mask=0, flags=0)
             max_cqe = attr.max_cqe
             cq_attrs_ex.cqe = max_cqe + 1 + int(100 * random.random())
             try:
                 CQEX(ctx, cq_attrs_ex)
             except PyverbsError as ex:
                 assert 'Failed to create extended CQ' in ex.args[0]
                 assert ' Errno: 22' in ex.args[0]
             else:
                 raise PyverbsError(
                     'Created a CQEX with {c} CQEs while device\'s max CQE={dc}'.
                     format(c=cq_attrs_ex.cqe, dc=max_cqe))
             comp_channel = random.randint(ctx.num_comp_vectors, 100)
             cq_attrs_ex.comp_vector = comp_channel
             cq_attrs_ex.cqe = get_num_cqes(attr)
             try:
                 CQEX(ctx, cq_attrs_ex)
             except PyverbsError as ex:
                 assert 'Failed to create extended CQ' in ex.args[0]
                 assert ' Errno: 22' in ex.args[0]
             else:
                 raise PyverbsError(
                     'Created a CQEX with comp_vector={c} while device\'s num_comp_vectors={dc}'.
                     format(c=comp_channel, dc=ctx.num_comp_vectors))
Пример #2
0
    def test_create_cq_ex_bad_flow(self):
        """
        Test ibv_create_cq_ex() with wrong comp_vector / number of cqes
        """
        cq_attrs_ex = CqInitAttrEx(cqe=self.max_cqe + 1,
                                   wc_flags=0,
                                   comp_mask=0,
                                   flags=0)
        with self.assertRaises(PyverbsRDMAError) as ex:
            CQEX(self.ctx, cq_attrs_ex)
        if ex.exception.error_code == errno.EOPNOTSUPP:
            raise unittest.SkipTest('Create Extended CQ is not supported')
        self.assertEqual(ex.exception.error_code, errno.EINVAL)

        cq_attrs_ex = CqInitAttrEx(10, wc_flags=0, comp_mask=0, flags=0)
        cq_attrs_ex.comp_vector = self.ctx.num_comp_vectors + 1
        with self.assertRaises(PyverbsRDMAError) as ex:
            CQEX(self.ctx, cq_attrs_ex)
        self.assertEqual(ex.exception.error_code, errno.EINVAL)