Fix wb xfailed test, update exported obj md5

Signed-off-by: Kamil Lepek <kamil.lepek94@gmail.com>
This commit is contained in:
Kamil Lepek
2019-06-18 15:46:15 +02:00
parent 34a5b8e882
commit bdfd086d81
2 changed files with 32 additions and 21 deletions

View File

@@ -158,21 +158,31 @@ class Core:
logging.getLogger("pyocf").warning(
"Reading whole exported object! This disturbs statistics values"
)
read_buffer = Data(self.device.size)
io = self.new_io()
io.configure(0, read_buffer.size, IoDir.READ, 0, 0)
io.set_data(read_buffer)
io.set_queue(self.cache.get_default_queue())
cmpl = OcfCompletion([("err", c_int)])
io.callback = cmpl.callback
io.submit()
cmpl.wait()
cache_line_size = int(self.cache.get_stats()['conf']['cache_line_size'])
read_buffer_all = Data(self.device.size)
if cmpl.results["err"]:
raise Exception("Error reading whole exported object")
read_buffer = Data(cache_line_size)
return read_buffer.md5()
position = 0
while position < read_buffer_all.size:
io = self.new_io()
io.configure(position, cache_line_size, IoDir.READ, 0, 0)
io.set_data(read_buffer)
io.set_queue(self.cache.get_default_queue())
cmpl = OcfCompletion([("err", c_int)])
io.callback = cmpl.callback
io.submit()
cmpl.wait()
if cmpl.results["err"]:
raise Exception("Error reading whole exported object")
read_buffer_all.copy(read_buffer, position, 0, cache_line_size)
position += cache_line_size
return read_buffer_all.md5()
lib = OcfLib.getInstance()