pyocf: minor security test fixes

Signed-off-by: Michal Mielewczyk <michal.mielewczyk@intel.com>
This commit is contained in:
Michal Mielewczyk 2022-03-31 09:40:11 +02:00
parent ca8531a421
commit 09d2843468
2 changed files with 4 additions and 3 deletions

View File

@ -91,7 +91,7 @@ def test_neg_attach_cls(pyocf_ctx, cm, cls):
""" """
# Start cache device # Start cache device
cache_device = RamVolume(S.from_MiB(50)) cache_device = RamVolume(S.from_MiB(50))
cache = Cache(owner=cache_device.owner, cache_mode=cm, cache_line_size=cls) cache = Cache(owner=pyocf_ctx, cache_mode=cm, cache_line_size=cls)
cache.start_cache() cache.start_cache()
# Check whether it is possible to attach cache device with invalid cache line size # Check whether it is possible to attach cache device with invalid cache line size

View File

@ -128,9 +128,10 @@ def test_neg_offset_unaligned(pyocf_ctx, c_int_randomize):
""" """
vol, queue = prepare_cache_and_core(Size.from_MiB(2)) vol, queue = prepare_cache_and_core(Size.from_MiB(2))
vol = vol.get_front_volume()
data = Data(int(Size.from_KiB(1))) data = Data(int(Size.from_KiB(1)))
if c_int_randomize % 512 != 0: if c_int_randomize % 512 != 0:
with pytest.raises(Exception, match="Failed to create io!"): with pytest.raises(Exception):
vol.new_io(queue, c_int_randomize, data.size, vol.new_io(queue, c_int_randomize, data.size,
IoDir.WRITE, 0, 0) IoDir.WRITE, 0, 0)
@ -145,7 +146,7 @@ def test_neg_size_unaligned(pyocf_ctx, c_uint16_randomize):
vol, queue = prepare_cache_and_core(Size.from_MiB(2)) vol, queue = prepare_cache_and_core(Size.from_MiB(2))
data = Data(int(Size.from_B(c_uint16_randomize))) data = Data(int(Size.from_B(c_uint16_randomize)))
if c_uint16_randomize % 512 != 0: if c_uint16_randomize % 512 != 0:
with pytest.raises(Exception, match="Failed to create io!"): with pytest.raises(Exception):
vol.new_io(queue, 0, data.size, vol.new_io(queue, 0, data.size,
IoDir.WRITE, 0, 0) IoDir.WRITE, 0, 0)