Update TF and functional tests API

Signed-off-by: Slawomir Jankowski <slawomir.jankowski@intel.com>
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
Slawomir Jankowski
2020-12-07 16:52:36 +01:00
committed by Robert Baldyga
parent ecbd4fbe30
commit 17f440de10
56 changed files with 209 additions and 210 deletions

View File

@@ -100,7 +100,7 @@ def test_block_stats_write(cache_mode, zero_stats):
dd = (
Dd()
.input("/dev/zero")
.output(f"{core.system_path}")
.output(f"{core.path}")
.count(dd_count)
.block_size(dd_size)
.oflag("direct")
@@ -225,7 +225,7 @@ def test_block_stats_read(cache_mode, zero_stats):
dd = (
Dd()
.output("/dev/zero")
.input(f"{core.system_path}")
.input(f"{core.path}")
.count(dd_count)
.block_size(dd_size)
.iflag("direct")

View File

@@ -271,8 +271,8 @@ def dd_builder(cache_mode, cache_line_size, count, device):
.count(count))
if CacheModeTrait.InsertRead in CacheMode.get_traits(cache_mode):
dd.input(device.system_path).output("/dev/null").iflag("direct")
dd.input(device.path).output("/dev/null").iflag("direct")
else:
dd.input("/dev/urandom").output(device.system_path).oflag("direct")
dd.input("/dev/urandom").output(device.path).oflag("direct")
return dd

View File

@@ -66,7 +66,7 @@ def test_cache_config_stats():
fio = fio_prepare()
for i in range(caches_count):
for j in range(cores_per_cache):
fio.add_job().target(cores[i][j].system_path)
fio.add_job().target(cores[i][j].path)
fio_pid = fio.run_in_background()
with TestRun.step(f"Wait {time_to_wait} seconds"):
@@ -107,7 +107,7 @@ def test_core_config_stats():
fio = fio_prepare()
for i in range(caches_count):
for j in range(cores_per_cache):
fio.add_job().target(cores[i][j].system_path)
fio.add_job().target(cores[i][j].path)
fio_pid = fio.run_in_background()
with TestRun.step(f"Wait {time_to_wait} seconds"):
@@ -255,11 +255,11 @@ def validate_cache_config_statistics(caches, after_io: bool = False):
failed_stats += (
f"For cache number {caches[i].cache_id} cache ID is "
f"{caches_stats[i].config_stats.cache_id}\n")
if caches_stats[i].config_stats.cache_dev != caches[i].cache_device.system_path:
if caches_stats[i].config_stats.cache_dev != caches[i].cache_device.path:
failed_stats += (
f"For cache number {caches[i].cache_id} cache device "
f"is {caches_stats[i].config_stats.cache_dev}, "
f"should be {caches[i].cache_device.system_path}\n")
f"should be {caches[i].cache_device.path}\n")
if caches_stats[i].config_stats.cache_size.value != caches[i].size.value:
failed_stats += (
f"For cache number {caches[i].cache_id} cache size is "
@@ -344,23 +344,23 @@ def validate_core_config_statistics(cores, caches=None):
for j in range(cores_per_cache)
]
for j in range(cores_per_cache):
if cores_stats[j].config_stats.exp_obj != cores[i][j].system_path:
if cores_stats[j].config_stats.exp_obj != cores[i][j].path:
failed_stats += (
f"For exported object {cores[i][j].system_path} "
f"For exported object {cores[i][j].path} "
f"value in stats is {cores_stats[j].config_stats.exp_obj}\n")
if cores_stats[j].config_stats.core_id != cores[i][j].core_id:
failed_stats += (
f"For exported object {cores[i][j].system_path} "
f"For exported object {cores[i][j].path} "
f"core ID is {cores_stats[j].config_stats.core_id}, "
f"should be {cores[i][j].core_id}\n")
if cores_stats[j].config_stats.core_dev != cores[i][j].core_device.system_path:
if cores_stats[j].config_stats.core_dev != cores[i][j].core_device.path:
failed_stats += (
f"For exported object {cores[i][j].system_path} "
f"For exported object {cores[i][j].path} "
f"core device is {cores_stats[j].config_stats.core_dev}, "
f"should be {cores[i][j].core_device.system_path}\n")
f"should be {cores[i][j].core_device.path}\n")
if cores_stats[j].config_stats.core_size.value != cores[i][j].size.value:
failed_stats += (
f"For exported object {cores[i][j].system_path} "
f"For exported object {cores[i][j].path} "
f"core size is {cores_stats[j].config_stats.core_size.value}, "
f"should be {cores[i][j].size.value}\n")
if (
@@ -368,16 +368,16 @@ def validate_core_config_statistics(cores, caches=None):
!= cores[i][j].get_status()
):
failed_stats += (
f"For exported object {cores[i][j].system_path} core "
f"For exported object {cores[i][j].path} core "
f"status is {cores_stats[j].config_stats.status}, should be "
f"{str(cores[i][j].get_status()).split('.')[1].capitalize()}\n")
if cores_stats[j].config_stats.seq_cutoff_policy is None:
failed_stats += (
f"For exported object {cores[i][j].system_path} value of "
f"For exported object {cores[i][j].path} value of "
f"Sequential cut-off policy should not be empty\n")
if cores_stats[j].config_stats.seq_cutoff_threshold.value <= 0:
failed_stats += (
f"For exported object {cores[i][j].system_path} value of "
f"For exported object {cores[i][j].path} value of "
f"Sequential cut-off threshold should be greater then 0\n")
if caches:
cache_mode = CacheMode[
@@ -386,21 +386,21 @@ def validate_core_config_statistics(cores, caches=None):
if CacheModeTrait.LazyWrites in CacheMode.get_traits(cache_mode):
if cores_stats[j].config_stats.dirty_for.total_seconds() <= 0:
failed_stats += (
f"For exported object {cores[i][j].system_path} in "
f"For exported object {cores[i][j].path} in "
f"{cache_mode} cache mode, value of 'Dirty for' "
f"after IO is {cores_stats[j].config_stats.dirty_for}, "
f"should be greater then 0\n")
else:
if cores_stats[j].config_stats.dirty_for.total_seconds() != 0:
failed_stats += (
f"For exported object {cores[i][j].system_path} in "
f"For exported object {cores[i][j].path} in "
f"{cache_mode} cache mode, value of 'Dirty for' "
f"after IO is {cores_stats[j].config_stats.dirty_for}, "
f"should equal 0\n")
else:
if cores_stats[j].config_stats.dirty_for.total_seconds() < 0:
failed_stats += (
f"For exported object {cores[i][j].system_path} value of "
f"For exported object {cores[i][j].path} value of "
f"'Dirty for' is {cores_stats[j].config_stats.dirty_for}, "
f"should be greater or equal 0\n")
@@ -412,7 +412,7 @@ def validate_core_config_statistics(cores, caches=None):
def validate_statistics_flat(device, stats, stat_filter, per_core: bool):
device_name = (
f"core device {device.system_path}" if per_core else
f"core device {device.path}" if per_core else
f"cache number {device.cache_id}")
failed_stats = ""
if stat_filter == StatsFilter.usage:

View File

@@ -310,7 +310,7 @@ def prepare(random_cls, cache_count=1, cores_per_cache=1):
Udev.disable()
caches, cores = [], []
for i, cache_device in enumerate(cache_devices):
TestRun.LOGGER.info(f"Starting cache on {cache_device.system_path}")
TestRun.LOGGER.info(f"Starting cache on {cache_device.path}")
cache = casadm.start_cache(cache_device,
force=True,
cache_mode=cache_modes[i],
@@ -320,7 +320,7 @@ def prepare(random_cls, cache_count=1, cores_per_cache=1):
cache.set_cleaning_policy(CleaningPolicy.nop)
for core_device in core_devices[i * cores_per_cache:(i + 1) * cores_per_cache]:
TestRun.LOGGER.info(
f"Adding core device {core_device.system_path} to cache {cache.cache_id}")
f"Adding core device {core_device.path} to cache {cache.cache_id}")
core = cache.add_core(core_dev=core_device)
core.reset_counters()
cores.append(core)

View File

@@ -78,7 +78,7 @@ def test_stat_max_cache():
fio = fio_prepare()
for i in range(caches_count):
for j in range(cores_per_cache):
fio.add_job().target(cores[i][j].system_path)
fio.add_job().target(cores[i][j].path)
fio.run()
sleep(3)
@@ -128,7 +128,7 @@ def test_stat_max_core(cache_mode):
with TestRun.step("Run 'fio'"):
fio = fio_prepare()
for j in range(cores_per_cache):
fio.add_job().target(cores[j].system_path)
fio.add_job().target(cores[j].path)
fio.run()
sleep(3)

View File

@@ -61,7 +61,7 @@ def test_stats_values():
fio = fio_prepare()
for i in range(caches_count):
for j in range(cores_per_cache):
fio.add_job().target(cores[i][j].system_path)
fio.add_job().target(cores[i][j].path)
fio.run()
sleep(3)
@@ -156,22 +156,22 @@ def check_stats_initial(caches, cores):
if stat_name.lower() == "free":
if stat_value != caches[i].size.value:
TestRun.LOGGER.error(
f"For core device {cores[i][j].system_path} "
f"For core device {cores[i][j].path} "
f"value for '{stat_name}' is {stat_value}, "
f"should equal cache size: {caches[i].size.value}\n")
elif stat_value != 0:
TestRun.LOGGER.error(
f"For core device {cores[i][j].system_path} value for "
f"For core device {cores[i][j].path} value for "
f"'{stat_name}' is {stat_value}, should equal 0\n")
for stat_name, stat_value in cores_stats_perc[j].items():
if stat_name.lower() == "free":
if stat_value != 100:
TestRun.LOGGER.error(
f"For core device {cores[i][j].system_path} percentage value "
f"For core device {cores[i][j].path} percentage value "
f"for '{stat_name}' is {stat_value}, should equal 100\n")
elif stat_value != 0:
TestRun.LOGGER.error(
f"For core device {cores[i][j].system_path} percentage value "
f"For core device {cores[i][j].path} percentage value "
f"for '{stat_name}' is {stat_value}, should equal 0\n")
@@ -191,7 +191,7 @@ def check_stats_after_io(caches, cores, after_reload: bool = False):
)
for j in range(cores_per_cache):
fail_message = (
f"For core device {cores[i][j].system_path} in {cache_mode} cache mode ")
f"For core device {cores[i][j].path} in {cache_mode} cache mode ")
if after_reload:
validate_usage_stats(
cores_stats[j], cores_stats_perc[j], caches[i], cache_mode, fail_message)