Example #1
0
 def test_destroy_dm_mr(self):
     """
     Test freeing of dm_mr
     """
     for ctx, attr, attr_ex in self.devices:
         if attr_ex.max_dm_size == 0:
             return
         with PD(ctx) as pd:
             for i in range(10):
                 dm_len = random.randrange(u.MIN_DM_SIZE, attr_ex.max_dm_size,
                                           u.DM_ALIGNMENT)
                 dm_attrs = u.get_dm_attrs(dm_len)
                 with d.DM(ctx, dm_attrs) as dm:
                     dm_mr_len = random.randint(1, dm_len)
                     dm_mr_offset = random.randint(0, (dm_len - dm_mr_len))
                     dm_mr = DMMR(pd, dm_mr_len, e.IBV_ACCESS_ZERO_BASED,
                                  dm=dm, offset=dm_mr_offset)
                     dm_mr.close()
Example #2
0
 def test_destroy_dm_mr(self):
     """
     Test freeing of dm_mr
     """
     lst = d.get_device_list()
     for dev in lst:
         with d.Context(name=dev.name.decode()) as ctx:
             attr = ctx.query_device_ex()
             if attr.max_dm_size == 0:
                 return
             with PD(ctx) as pd:
                 dm_len = random.randrange(u.MIN_DM_SIZE, attr.max_dm_size,
                                           u.DM_ALIGNMENT)
                 dm_attrs = u.get_dm_attrs(dm_len)
                 with d.DM(ctx, dm_attrs) as dm:
                     dm_mr_len = random.randint(1, dm_len)
                     dm_mr_offset = random.randint(0, (dm_len - dm_mr_len))
                     dm_mr = DMMR(pd,
                                  dm_mr_len,
                                  e.IBV_ACCESS_ZERO_BASED,
                                  dm=dm,
                                  offset=dm_mr_offset)
                     dm_mr.close()