Merge pull request #314 from Deixx/align

Size alignment update in tests
This commit is contained in:
Michal Rakowski 2020-02-13 13:50:34 +01:00 committed by GitHub
commit 30b06e07a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 14 deletions

@ -1 +1 @@
Subproject commit 6afb2b5581e2646ff0344a00db9259a735e20536 Subproject commit d0d147a382ab8913cb2457369c86c9e2dca59759

View File

@ -4,19 +4,20 @@
# #
import pytest
import random import random
from enum import Enum, auto from enum import Enum, auto
from api.cas import casadm
from api.cas.core import SEQ_CUTOFF_THRESHOLD_MAX
from api.cas.cache_config import SeqCutOffPolicy, CacheMode, CacheLineSize
from core.test_run import TestRun
import pytest
from api.cas import casadm
from api.cas.cache_config import SeqCutOffPolicy, CacheMode, CacheLineSize
from api.cas.core import SEQ_CUTOFF_THRESHOLD_MAX
from core.test_run import TestRun
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
from test_utils.size import Size, Unit
from test_utils.os_utils import Udev, sync
from test_tools.fio.fio import Fio from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import ReadWrite, IoEngine from test_tools.fio.fio_param import ReadWrite, IoEngine
from test_utils.os_utils import Udev, sync
from test_utils.size import Size, Unit
class VerifyType(Enum): class VerifyType(Enum):
@ -59,7 +60,7 @@ def test_seq_cutoff_multi_core(thresholds_list, cache_mode, io_type, io_type_las
fio_additional_size = Size(10, Unit.Blocks4096) fio_additional_size = Size(10, Unit.Blocks4096)
for i in range(len(thresholds_list)): for i in range(len(thresholds_list)):
thresholds.append(Size(thresholds_list[i], Unit.KibiByte)) thresholds.append(Size(thresholds_list[i], Unit.KibiByte))
io_sizes.append((thresholds[i] + fio_additional_size).align(0x1000)) io_sizes.append((thresholds[i] + fio_additional_size).align_down(0x1000))
with TestRun.step(f"Setting cache mode to {cache_mode}"): with TestRun.step(f"Setting cache mode to {cache_mode}"):
cache.set_cache_mode(cache_mode) cache.set_cache_mode(cache_mode)
@ -133,7 +134,7 @@ def test_seq_cutoff_thresh(threshold_param, cls, io_dir, policy, verify_type):
cache, cores = prepare(cores_count=1, cache_line_size=cls) cache, cores = prepare(cores_count=1, cache_line_size=cls)
fio_additional_size = Size(10, Unit.Blocks4096) fio_additional_size = Size(10, Unit.Blocks4096)
threshold = Size(threshold_param, Unit.KibiByte) threshold = Size(threshold_param, Unit.KibiByte)
io_size = (threshold + fio_additional_size).align(0x1000) io_size = (threshold + fio_additional_size).align_down(0x1000)
with TestRun.step(f"Setting cache sequential cut off policy mode to {policy}"): with TestRun.step(f"Setting cache sequential cut off policy mode to {policy}"):
cache.set_seq_cutoff_policy(policy) cache.set_seq_cutoff_policy(policy)
@ -181,7 +182,7 @@ def test_seq_cutoff_thresh_fill(threshold_param, cls, io_dir):
cache, cores = prepare(cores_count=1, cache_line_size=cls) cache, cores = prepare(cores_count=1, cache_line_size=cls)
fio_additional_size = Size(10, Unit.Blocks4096) fio_additional_size = Size(10, Unit.Blocks4096)
threshold = Size(threshold_param, Unit.KibiByte) threshold = Size(threshold_param, Unit.KibiByte)
io_size = (threshold + fio_additional_size).align(0x1000) io_size = (threshold + fio_additional_size).align_down(0x1000)
with TestRun.step(f"Setting cache sequential cut off policy mode to " with TestRun.step(f"Setting cache sequential cut off policy mode to "
f"{SeqCutOffPolicy.never}"): f"{SeqCutOffPolicy.never}"):
@ -246,9 +247,10 @@ def verify_writes_count(core, writes_before, threshold, io_size, ver_type=Verify
def prepare(cores_count=1, cache_line_size: CacheLineSize = None): def prepare(cores_count=1, cache_line_size: CacheLineSize = None):
cache_device = TestRun.disks['cache'] cache_device = TestRun.disks['cache']
core_device = TestRun.disks['core'] core_device = TestRun.disks['core']
cache_device.create_partitions([(SEQ_CUTOFF_THRESHOLD_MAX * cores_count cache_device.create_partitions(
+ Size(5, Unit.GibiByte)).align(0x1000)]) [(SEQ_CUTOFF_THRESHOLD_MAX * cores_count + Size(5, Unit.GibiByte)).align_down(0x1000)])
partitions = [(SEQ_CUTOFF_THRESHOLD_MAX + Size(10, Unit.GibiByte)).align(0x1000)] * cores_count partitions = \
[(SEQ_CUTOFF_THRESHOLD_MAX + Size(10, Unit.GibiByte)).align_down(0x1000)] * cores_count
core_device.create_partitions(partitions) core_device.create_partitions(partitions)
cache_part = cache_device.partitions[0] cache_part = cache_device.partitions[0]
core_parts = core_device.partitions core_parts = core_device.partitions