def test_start_stop_noqueue(pyocf_ctx): # cache object just to construct cfg conveniently _cache = Cache(pyocf_ctx.ctx_handle) cache_handle = c_void_p() status = pyocf_ctx.lib.ocf_mngt_cache_start( pyocf_ctx.ctx_handle, byref(cache_handle), byref(_cache.cfg) ) assert not status, "Failed to start cache: {}".format(status) # stop without creating mngmt queue c = OcfCompletion( [("cache", c_void_p), ("priv", c_void_p), ("error", c_int)] ) pyocf_ctx.lib.ocf_mngt_cache_stop(cache_handle, c, None) c.wait() assert not c.results["error"], "Failed to stop cache: {}".format(c.results["error"])
def test_neg_attach_cls(pyocf_ctx, cm, cls): """ Test whether it is possible to change cache line size to invalid value while attaching cache device :param pyocf_ctx: basic pyocf context fixture :param cm: cache mode we start with :param cls: cache line size we start with :return: """ # Start cache device cache_device = Volume(S.from_MiB(30)) cache = Cache(owner=cache_device.owner, cache_mode=cm, cache_line_size=cls) cache.start_cache() # Check whether it is possible to attach cache device with invalid cache line size for i in RandomGenerator(DefaultRanges.UINT64): if i in [item.value for item in CacheLineSize]: continue with pytest.raises(OcfError, match="Attaching cache device failed"): cache.attach_device(cache_device, cache_line_size=i)