tests: Introduce cache/core flush test

Signed-off-by: Robert Baldyga <robert.baldyga@huawei.com>
Signed-off-by: Michal Mielewczyk <michal.mielewczyk@huawei.com>
This commit is contained in:
Robert Baldyga
2024-02-17 12:05:19 +01:00
committed by Michal Mielewczyk
parent b8ea10f30c
commit b16b49c84d
2 changed files with 105 additions and 0 deletions

View File

@@ -171,6 +171,17 @@ class Core:
if status:
raise OcfError("Error setting core seq cut off policy promotion count", status)
def flush(self):
self.cache.write_lock()
c = OcfCompletion([("core", c_void_p), ("priv", c_void_p), ("error", c_int)])
self.cache.owner.lib.ocf_mngt_core_flush(self.handle, c, None)
c.wait()
self.cache.write_unlock()
if c.results["error"]:
raise OcfError("Couldn't flush cache", c.results["error"])
def reset_stats(self):
lib.ocf_core_stats_initialize(self.handle)
@@ -194,3 +205,5 @@ lib.ocf_core_get_info.argtypes = [c_void_p, c_void_p]
lib.ocf_core_get_info.restype = c_int
lib.ocf_core_stats_initialize.argtypes = [c_void_p]
lib.ocf_core_stats_initialize.restype = c_void_p
lib.ocf_mngt_core_flush.argtypes = [c_void_p, c_void_p, c_void_p]
lib.ocf_mngt_core_flush.restype = c_void_p