Pyocf tests for start/stop

Tests for starting cache and checking if mode works properly
Tests for stopping cache
Negative and stress tests

Signed-off-by: Daniel Madej <daniel.madej@intel.com>
This commit is contained in:
Daniel Madej
2019-04-08 11:26:12 +02:00
parent d3bfbf6200
commit 1aa5e99173
3 changed files with 455 additions and 2 deletions

View File

@@ -154,7 +154,6 @@ class Cache:
self.cache_handle = c_void_p()
self._as_parameter_ = self.cache_handle
self.io_queues = []
self.device = None
self.cores = []
def start_cache(
@@ -425,6 +424,7 @@ class Cache:
raise OcfError("Failed getting stats", status)
line_size = CacheLineSize(cache_info.cache_line_size)
cache_id = self.owner.lib.ocf_cache_get_id(self)
self.put_and_read_unlock()
return {
@@ -455,6 +455,7 @@ class Cache:
"core_count": cache_info.core_count,
"metadata_footprint": Size(cache_info.metadata_footprint),
"metadata_end_offset": Size(cache_info.metadata_end_offset),
"cache_id": cache_id,
},
"block": struct_to_dict(block),
"req": struct_to_dict(req),

View File

@@ -3,7 +3,7 @@
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
from ctypes import c_void_p, Structure, c_char_p, cast, pointer, byref
from ctypes import c_void_p, Structure, c_char_p, cast, pointer, byref, c_int
from .logger import LoggerOps, Logger
from .data import DataOps, Data
@@ -119,3 +119,8 @@ def get_default_ctx(logger):
MetadataUpdater,
Cleaner,
)
lib = OcfLib.getInstance()
lib.ocf_mngt_cache_get_by_id.argtypes = [c_void_p, c_void_p, c_void_p]
lib.ocf_mngt_cache_get_by_id.restype = c_int