OS tools refactor

Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
Katarzyna Treder
2024-12-11 07:58:50 +01:00
parent 3e67a8c0f5
commit 8a5d531a32
92 changed files with 187 additions and 173 deletions

View File

@@ -24,7 +24,7 @@ from storage_devices.disk import DiskTypeSet, DiskTypeLowerThan, DiskType
from test_tools.blktrace import BlkTrace, BlkTraceMask, ActionKind, RwbsKind
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import IoEngine, ReadWrite
from test_utils.os_utils import kill_all_io
from test_tools.os_tools import kill_all_io
from types.size import Size, Unit
from types.time import Time

View File

@@ -14,7 +14,8 @@ from core.test_run import TestRun
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import ReadWrite, IoEngine
from test_utils.os_utils import Udev, kill_all_io
from test_tools.os_tools import kill_all_io
from test_tools.udev import Udev
from types.size import Size, Unit
from types.time import Time

View File

@@ -18,7 +18,7 @@ from api.cas.cache_config import (
from core.test_run import TestRun
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
from test_tools.dd import Dd
from test_utils.os_utils import Udev
from test_tools.udev import Udev
from types.size import Size, Unit
from types.time import Time

View File

@@ -9,7 +9,6 @@ import test_tools.common.wait
from core.test_run import TestRun
from test_tools import fs_utils
from test_tools.dd import Dd
from test_utils import os_utils
from test_utils.filesystem.file import File
from types.size import Size, Unit

View File

@@ -15,9 +15,8 @@ from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
from test_tools.disk_utils import Filesystem
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import IoEngine, ReadWrite
from test_utils import os_utils
from test_utils.filesystem.file import File
from test_utils.os_utils import DropCachesMode
from test_tools.os_tools import DropCachesMode, drop_caches, sync
from types.size import Size, Unit
from types.time import Time
from tests.lazy_writes.recovery.recovery_tests_methods import power_cycle_dut
@@ -63,7 +62,7 @@ def test_recovery_all_options(cache_mode, cache_line_size, cleaning_policy, file
with TestRun.step("Mount core device."):
core_device.mount(mount_point)
file_operation(test_file.full_path, other_pattern, ReadWrite.write)
os_utils.drop_caches(DropCachesMode.ALL)
drop_caches(DropCachesMode.ALL)
with TestRun.step("Unmount core device."):
core_device.unmount()
@@ -85,9 +84,9 @@ def test_recovery_all_options(cache_mode, cache_line_size, cleaning_policy, file
cache.set_cache_mode(CacheMode.WT, flush=False)
with TestRun.step("Reset platform."):
os_utils.sync()
sync()
core.unmount()
os_utils.drop_caches(DropCachesMode.ALL)
drop_caches(DropCachesMode.ALL)
TestRun.LOGGER.info(f"Number of dirty blocks in cache: {cache.get_dirty_blocks()}")
power_cycle_dut()

View File

@@ -13,8 +13,8 @@ from core.test_run import TestRun
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
from test_tools.disk_utils import Filesystem
from test_tools.fs_utils import readlink
from test_utils import os_utils
from test_utils.os_utils import Udev, DropCachesMode
from test_tools.os_tools import DropCachesMode, sync, drop_caches
from test_tools.udev import Udev
from connection.utils.output import CmdException
from types.size import Size, Unit
from tests.lazy_writes.recovery.recovery_tests_methods import create_test_files, copy_file, \
@@ -62,13 +62,13 @@ def test_recovery_flush_reset_raw(cache_mode):
direct="oflag")
with TestRun.step("Sync and flush buffers."):
os_utils.sync()
sync()
output = TestRun.executor.run(f"hdparm -f {core.path}")
if output.exit_code != 0:
raise CmdException("Error during hdparm", output)
with TestRun.step("Trigger flush."):
os_utils.drop_caches(DropCachesMode.ALL)
drop_caches(DropCachesMode.ALL)
TestRun.executor.run_in_background(cli.flush_cache_cmd(f"{cache.cache_id}"))
with TestRun.step("Hard reset DUT during data flushing."):

View File

@@ -10,7 +10,7 @@ from core.test_run_utils import TestRun
from storage_devices.disk import DiskTypeSet, DiskType, DiskTypeLowerThan
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import ReadWrite, IoEngine
from test_utils.os_utils import Udev
from test_tools.udev import Udev
from types.size import Size, Unit

View File

@@ -18,7 +18,8 @@ from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import IoEngine, ReadWrite
from test_tools.fs_utils import remove
from test_utils.filesystem.file import File
from test_utils.os_utils import sync, Udev
from test_tools.os_tools import sync
from test_tools.udev import Udev
from types.size import Size, Unit
file_size = Size(640, Unit.GiB)

View File

@@ -15,7 +15,8 @@ from test_tools.disk_utils import Filesystem
from test_tools.fs_utils import create_random_test_file, remove
from test_tools.iostat import IOstatBasic
from test_utils.filesystem.file import File
from test_utils.os_utils import Udev, sync
from test_tools.os_tools import sync
from test_tools.udev import Udev
from types.size import Size, Unit
bs = Size(512, Unit.KibiByte)

View File

@@ -16,8 +16,8 @@ from storage_devices.disk import DiskType, DiskTypeSet
from core.test_run import TestRun
from test_tools.disk_utils import Filesystem
from test_tools.fs_utils import create_random_test_file
from test_tools.os_tools import sync
from test_tools.scsi_debug import Logs, syslog_path
from test_utils import os_utils
from types.size import Size, Unit
mount_point = "/mnt/cas"
@@ -60,11 +60,11 @@ def test_flush_signal_core(cache_mode):
with TestRun.step("Create temporary file on exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(1, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Flush cache."):
cache.flush_cache()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush request and delete temporary file."):
Logs.check_syslog_for_signals()
@@ -72,11 +72,11 @@ def test_flush_signal_core(cache_mode):
with TestRun.step("Create temporary file on exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(1, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Flush core."):
core.flush_core()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush request and delete temporary file."):
Logs.check_syslog_for_signals()
@@ -90,7 +90,7 @@ def test_flush_signal_core(cache_mode):
with TestRun.step("Create big temporary file on exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(5, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Wait for automatic flush from alru cleaning policy and check log."):
wait_time = (
@@ -107,12 +107,12 @@ def test_flush_signal_core(cache_mode):
with TestRun.step("Create temporary file on exported object."):
create_random_test_file(f"{mount_point}/tmp.file", Size(1, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Unmount exported object and remove it from cache."):
core.unmount()
core.remove_core()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush request."):
Logs.check_syslog_for_signals()
@@ -158,11 +158,11 @@ def test_flush_signal_cache(cache_mode):
with TestRun.step("Create temporary file on exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(1, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Flush cache."):
cache.flush_cache()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush and FUA requests and delete temporary file."):
Logs.check_syslog_for_signals()
@@ -170,11 +170,11 @@ def test_flush_signal_cache(cache_mode):
with TestRun.step("Create temporary file on exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(1, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Flush core."):
core.flush_core()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush request and delete temporary file."):
Logs.check_syslog_for_signals()
@@ -188,7 +188,7 @@ def test_flush_signal_cache(cache_mode):
with TestRun.step("Create big temporary file on exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(5, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Wait for automatic flush from alru cleaning policy and check log."):
wait_time = (
@@ -205,12 +205,12 @@ def test_flush_signal_cache(cache_mode):
with TestRun.step("Create temporary file on exported object."):
create_random_test_file(f"{mount_point}/tmp.file", Size(1, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Unmount exported object and remove it from cache."):
core.unmount()
core.remove_core()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush and FUA requests."):
Logs.check_syslog_for_signals()
@@ -262,12 +262,12 @@ def test_flush_signal_multilevel_cache(cache_mode):
with TestRun.step("Create temporary file on the 2nd exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(512, Unit.MebiByte))
os_utils.sync()
sync()
with TestRun.step("Flush both caches."):
cache2.flush_cache()
cache1.flush_cache()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush and FUA requests and delete temporary file."):
Logs.check_syslog_for_signals()
@@ -275,12 +275,12 @@ def test_flush_signal_multilevel_cache(cache_mode):
with TestRun.step("Create temporary file on the 2nd exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(512, Unit.MebiByte))
os_utils.sync()
sync()
with TestRun.step("Flush both cores."):
core2.flush_core()
core1.flush_core()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush request and delete temporary file."):
Logs.check_syslog_for_signals()
@@ -298,7 +298,7 @@ def test_flush_signal_multilevel_cache(cache_mode):
with TestRun.step("Create big temporary file on the 2nd exported object."):
tmp_file = create_random_test_file(f"{mount_point}/tmp.file", Size(3, Unit.GibiByte))
os_utils.sync()
sync()
with TestRun.step("Wait for automatic flush from alru cleaning policy and check log."):
wait_time = (
@@ -315,13 +315,13 @@ def test_flush_signal_multilevel_cache(cache_mode):
with TestRun.step("Create temporary file on the 2nd exported object."):
create_random_test_file(f"{mount_point}/tmp.file", Size(512, Unit.MebiByte))
os_utils.sync()
sync()
with TestRun.step("Unmount the 2nd exported object and remove cores from caches."):
core2.unmount()
core2.remove_core()
core1.remove_core()
os_utils.sync()
sync()
with TestRun.step(f"Check {syslog_path} for flush request."):
Logs.check_syslog_for_signals()

View File

@@ -12,25 +12,19 @@ from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
from test_tools.fio.fio import Fio
from test_tools.fio.fio_param import ReadWrite, IoEngine
from test_tools.iostat import IOstatExtended
from test_utils.os_utils import (
from test_tools.os_tools import (
kill_all_io,
set_wbt_lat,
get_wbt_lat,
get_dut_cpu_number,
)
from test_tools.common.wait import wait
from api.cas import casadm
from api.cas.cache_config import (
CacheMode,
CacheModeTrait,
CleaningPolicy,
FlushParametersAcp,
SeqCutOffPolicy,
CacheLineSize,
Time,
)
from test_tools.blktrace import BlkTrace, BlkTraceMask, ActionKind, RwbsKind
runtime = timedelta(days=30)