Fuzzy tests for casadm 'start cache' command
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
parent
f4bfd5398e
commit
fd7cf1ad7d
@ -0,0 +1,5 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
@ -0,0 +1,93 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (
|
||||
CacheMode,
|
||||
CacheLineSize,
|
||||
UnalignedIo,
|
||||
KernelParameters,
|
||||
UseIoScheduler,
|
||||
)
|
||||
from api.cas.cli import start_cmd
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet
|
||||
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.security.fuzzy.kernel.common.common import (
|
||||
run_cmd_and_validate,
|
||||
get_device_fuzz_config,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@pytest.mark.parametrizex("cache_mode", CacheMode)
|
||||
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||
def test_fuzzy_start_cache_device(cache_mode, cache_line_size, unaligned_io, use_io_scheduler):
|
||||
"""
|
||||
title: Fuzzy test for casadm 'start cache' command – cache device
|
||||
description: |
|
||||
Using Peach Fuzzer check Open CAS ability of handling wrong device id in
|
||||
'start cache' command.
|
||||
pass_criteria:
|
||||
- System did not crash
|
||||
- Open CAS still works.
|
||||
"""
|
||||
|
||||
cache_id = 1
|
||||
|
||||
with TestRun.step("Create partitions on all devices"):
|
||||
for disk in TestRun.dut.disks:
|
||||
disk.create_partitions([Size(400, Unit.MebiByte)])
|
||||
|
||||
with TestRun.step("Start and stop cache"):
|
||||
cache_disk = TestRun.disks["cache"]
|
||||
# Reload kernel modules
|
||||
cache = casadm.start_cache(
|
||||
cache_dev=cache_disk.partitions[0],
|
||||
cache_mode=cache_mode,
|
||||
cache_line_size=cache_line_size,
|
||||
cache_id=cache_id,
|
||||
force=True,
|
||||
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||
)
|
||||
cache.stop()
|
||||
|
||||
with TestRun.step("Prepare PeachFuzzer"):
|
||||
disks_paths = [disk.path for disk in TestRun.dut.disks]
|
||||
partitions_paths = [disk.partitions[0].path for disk in TestRun.dut.disks]
|
||||
valid_values = disks_paths + partitions_paths
|
||||
# fuzz only partitions to speed up test
|
||||
fuzz_config = get_device_fuzz_config(partitions_paths)
|
||||
valid_values = [path.encode("ascii") for path in valid_values]
|
||||
PeachFuzzer.generate_config(fuzz_config)
|
||||
base_cmd = start_cmd(
|
||||
cache_dev="{param}",
|
||||
cache_mode=cache_mode.name.lower(),
|
||||
cache_line_size=str(int(cache_line_size.value.get_value(Unit.KibiByte))),
|
||||
cache_id=str(cache_id),
|
||||
force=True,
|
||||
)
|
||||
commands = PeachFuzzer.get_fuzzed_command(
|
||||
command_template=base_cmd, count=TestRun.usr.fuzzy_iter_count
|
||||
)
|
||||
|
||||
for index, cmd in TestRun.iteration(
|
||||
enumerate(commands), f"Run command {TestRun.usr.fuzzy_iter_count} times"
|
||||
):
|
||||
with TestRun.step(f"Iteration {index + 1}"):
|
||||
output = run_cmd_and_validate(
|
||||
cmd=cmd,
|
||||
value_name="Device path",
|
||||
is_valid=cmd.param in valid_values,
|
||||
)
|
||||
if output.exit_code == 0:
|
||||
with TestRun.step("Stop cache"):
|
||||
casadm.stop_cache(cache_id=cache_id)
|
@ -0,0 +1,110 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import re
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (
|
||||
CacheMode,
|
||||
CacheLineSize,
|
||||
UnalignedIo,
|
||||
KernelParameters,
|
||||
UseIoScheduler,
|
||||
)
|
||||
from api.cas.cli import start_cmd
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet
|
||||
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.security.fuzzy.kernel.common.common import (
|
||||
get_fuzz_config,
|
||||
run_cmd_and_validate,
|
||||
get_cmd,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@pytest.mark.parametrizex("cache_mode", CacheMode)
|
||||
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||
def test_fuzzy_start_cache_flags(cache_mode, cache_line_size, unaligned_io, use_io_scheduler):
|
||||
"""
|
||||
title: Fuzzy test for casadm 'start cache' command – flags.
|
||||
description: |
|
||||
Using Peach Fuzzer check Open CAS ability of handling wrong flags in
|
||||
'start cache' command.
|
||||
pass_criteria:
|
||||
- System did not crash
|
||||
- Open CAS still works.
|
||||
"""
|
||||
|
||||
cache_id = 1
|
||||
|
||||
with TestRun.step("Create partition on cache device"):
|
||||
cache_disk = TestRun.disks["cache"]
|
||||
cache_disk.create_partitions([Size(400, Unit.MebiByte)])
|
||||
|
||||
with TestRun.step("Start and stop cache"):
|
||||
# Reload kernel modules
|
||||
cache = casadm.start_cache(
|
||||
cache_dev=cache_disk.partitions[0],
|
||||
cache_mode=cache_mode,
|
||||
cache_line_size=cache_line_size,
|
||||
cache_id=cache_id,
|
||||
force=True,
|
||||
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||
)
|
||||
cache.stop()
|
||||
|
||||
with TestRun.step("Prepare PeachFuzzer"):
|
||||
valid_values = ["", "--load", "-l", "--force", "-f"]
|
||||
fuzz_config = get_fuzz_config("flags.yml")
|
||||
PeachFuzzer.generate_config(fuzz_config)
|
||||
parameters = PeachFuzzer.generate_peach_fuzzer_parameters(TestRun.usr.fuzzy_iter_count)
|
||||
|
||||
for index, parameter in TestRun.iteration(
|
||||
enumerate(parameters), f"Run command {TestRun.usr.fuzzy_iter_count} times"
|
||||
):
|
||||
with TestRun.step(f"Iteration {index + 1}"):
|
||||
param = parameter.decode("ascii", "ignore").rstrip()
|
||||
base_cmd = start_cmd(
|
||||
cache_dev=cache_disk.partitions[0].path,
|
||||
cache_mode=cache_mode.name.lower(),
|
||||
cache_line_size=str(int(cache_line_size.value.get_value(Unit.KibiByte))),
|
||||
cache_id=str(cache_id),
|
||||
force=True,
|
||||
)
|
||||
# --force cannot be used alongside --load param
|
||||
if param in ["--load", "-l", "--force", "-f"]:
|
||||
base_cmd = base_cmd.replace("--force", "")
|
||||
# --cache-mode, --cache-line-size, --cache-id cannot be used alongside --load param
|
||||
if param in ["--load", "-l"]:
|
||||
incompatible_params = [
|
||||
"--cache-mode",
|
||||
"--cache-line-size",
|
||||
"--cache-id",
|
||||
]
|
||||
for incompatible_param in incompatible_params:
|
||||
any_alphanumeric_pattern = r"\w+"
|
||||
base_cmd = re.sub(
|
||||
pattern=f"{incompatible_param} {any_alphanumeric_pattern}",
|
||||
sub="",
|
||||
string=base_cmd,
|
||||
)
|
||||
base_cmd = f"{base_cmd.strip()} {param}"
|
||||
|
||||
cmd = get_cmd(base_cmd, param.encode("ascii"))
|
||||
|
||||
output = run_cmd_and_validate(
|
||||
cmd=cmd,
|
||||
value_name="Flag",
|
||||
is_valid=param in valid_values,
|
||||
)
|
||||
if output.exit_code == 0:
|
||||
with TestRun.step("Stop cache"):
|
||||
casadm.stop_cache(cache_id=cache_id)
|
@ -0,0 +1,95 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (
|
||||
CacheMode,
|
||||
CacheLineSize,
|
||||
UnalignedIo,
|
||||
KernelParameters,
|
||||
UseIoScheduler,
|
||||
)
|
||||
from api.cas.cli import start_cmd
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet
|
||||
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.security.fuzzy.kernel.common.common import (
|
||||
get_fuzz_config,
|
||||
run_cmd_and_validate,
|
||||
)
|
||||
|
||||
cache_id_min = 1
|
||||
cache_id_max = 16384
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@pytest.mark.parametrizex("cache_mode", CacheMode)
|
||||
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||
def test_fuzzy_start_cache_id(cache_mode, cache_line_size, unaligned_io, use_io_scheduler):
|
||||
"""
|
||||
title: Fuzzy test for casadm 'start cache' command – cache id
|
||||
description: |
|
||||
Using Peach Fuzzer check Open CAS ability of handling wrong cache id in
|
||||
'start cache' command.
|
||||
pass_criteria:
|
||||
- System did not crash
|
||||
- Open CAS still works.
|
||||
"""
|
||||
with TestRun.step("Create partition on cache device"):
|
||||
cache_disk = TestRun.disks["cache"]
|
||||
cache_disk.create_partitions([Size(400, Unit.MebiByte)])
|
||||
|
||||
with TestRun.step("Start and stop cache"):
|
||||
# Reload kernel modules
|
||||
cache = casadm.start_cache(
|
||||
cache_dev=cache_disk.partitions[0],
|
||||
cache_mode=cache_mode,
|
||||
cache_line_size=cache_line_size,
|
||||
cache_id=1,
|
||||
force=True,
|
||||
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||
)
|
||||
cache.stop()
|
||||
|
||||
with TestRun.step("Prepare PeachFuzzer"):
|
||||
fuzz_config = get_fuzz_config("cache_id.yml")
|
||||
PeachFuzzer.generate_config(fuzz_config)
|
||||
base_cmd = start_cmd(
|
||||
cache_dev=cache_disk.partitions[0].path,
|
||||
cache_mode=cache_mode.name.lower(),
|
||||
cache_line_size=str(int(cache_line_size.value.get_value(Unit.KibiByte))),
|
||||
cache_id="{param}",
|
||||
force=True,
|
||||
)
|
||||
commands = PeachFuzzer.get_fuzzed_command(
|
||||
command_template=base_cmd, count=TestRun.usr.fuzzy_iter_count
|
||||
)
|
||||
|
||||
for index, cmd in TestRun.iteration(
|
||||
enumerate(commands), f"Run command {TestRun.usr.fuzzy_iter_count} times"
|
||||
):
|
||||
with TestRun.step(f"Iteration {index + 1}"):
|
||||
output = run_cmd_and_validate(
|
||||
cmd=cmd,
|
||||
value_name="Cache id",
|
||||
is_valid=__is_valid(cmd.param),
|
||||
)
|
||||
if output.exit_code == 0:
|
||||
with TestRun.step("Stop cache"):
|
||||
casadm.stop_cache(cache_id=int(cmd.param))
|
||||
|
||||
|
||||
def __is_valid(parameter):
|
||||
try:
|
||||
value = int(parameter)
|
||||
except ValueError:
|
||||
return False
|
||||
return cache_id_min <= value <= cache_id_max
|
@ -0,0 +1,89 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (
|
||||
CacheMode,
|
||||
CacheLineSize,
|
||||
UnalignedIo,
|
||||
KernelParameters,
|
||||
UseIoScheduler,
|
||||
)
|
||||
from api.cas.cli import start_cmd
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet
|
||||
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.security.fuzzy.kernel.common.common import (
|
||||
run_cmd_and_validate,
|
||||
get_fuzz_config,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@pytest.mark.parametrizex("cache_mode", CacheMode)
|
||||
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||
def test_fuzzy_start_cache_line_size(cache_mode, unaligned_io, use_io_scheduler):
|
||||
"""
|
||||
title: Fuzzy test for casadm 'start cache' command – cache line size
|
||||
description: |
|
||||
Using Peach Fuzzer check Open CAS ability of handling wrong cache line size in
|
||||
'start cache' command.
|
||||
pass_criteria:
|
||||
- System did not crash
|
||||
- Open CAS still works.
|
||||
"""
|
||||
|
||||
cache_id = 1
|
||||
|
||||
with TestRun.step("Create partition on cache device"):
|
||||
cache_disk = TestRun.disks["cache"]
|
||||
cache_disk.create_partitions([Size(400, Unit.MebiByte)])
|
||||
|
||||
with TestRun.step("Start and stop cache"):
|
||||
# Reload kernel modules
|
||||
cache = casadm.start_cache(
|
||||
cache_dev=cache_disk.partitions[0],
|
||||
cache_mode=cache_mode,
|
||||
cache_line_size=None,
|
||||
cache_id=cache_id,
|
||||
force=True,
|
||||
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||
)
|
||||
cache.stop()
|
||||
|
||||
with TestRun.step("Prepare PeachFuzzer"):
|
||||
valid_values = [
|
||||
str(int(e.value.get_value(Unit.KibiByte))).encode("ascii") for e in list(CacheLineSize)
|
||||
]
|
||||
fuzz_config = get_fuzz_config("cache_line_size.yml")
|
||||
PeachFuzzer.generate_config(fuzz_config)
|
||||
base_cmd = start_cmd(
|
||||
cache_dev=cache_disk.partitions[0].path,
|
||||
cache_mode=cache_mode.name.lower(),
|
||||
cache_line_size="{param}",
|
||||
cache_id=str(cache_id),
|
||||
force=True,
|
||||
)
|
||||
commands = PeachFuzzer.get_fuzzed_command(
|
||||
command_template=base_cmd, count=TestRun.usr.fuzzy_iter_count
|
||||
)
|
||||
|
||||
for index, cmd in TestRun.iteration(
|
||||
enumerate(commands), f"Run command {TestRun.usr.fuzzy_iter_count} times"
|
||||
):
|
||||
with TestRun.step(f"Iteration {index + 1}"):
|
||||
output = run_cmd_and_validate(
|
||||
cmd=cmd,
|
||||
value_name="Cache line size",
|
||||
is_valid=cmd.param in valid_values,
|
||||
)
|
||||
if output.exit_code == 0:
|
||||
with TestRun.step("Stop cache"):
|
||||
casadm.stop_cache(cache_id=cache_id)
|
@ -0,0 +1,87 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (
|
||||
CacheMode,
|
||||
CacheLineSize,
|
||||
UnalignedIo,
|
||||
KernelParameters,
|
||||
UseIoScheduler,
|
||||
)
|
||||
from api.cas.cli import start_cmd
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet
|
||||
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.security.fuzzy.kernel.common.common import (
|
||||
run_cmd_and_validate,
|
||||
get_device_fuzz_config,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@pytest.mark.parametrizex("cache_mode", CacheMode)
|
||||
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||
def test_fuzzy_start_cache_load_device(
|
||||
cache_mode,
|
||||
cache_line_size,
|
||||
unaligned_io,
|
||||
use_io_scheduler,
|
||||
):
|
||||
"""
|
||||
title: Fuzzy test for casadm 'start cache' command with load flag - device
|
||||
description: |
|
||||
Using Peach Fuzzer check Open CAS ability of handling wrong device in
|
||||
'start cache' command with load flag.
|
||||
pass_criteria:
|
||||
- System did not crash
|
||||
- Open CAS still works.
|
||||
"""
|
||||
|
||||
cache_id = 1
|
||||
|
||||
with TestRun.step("Create partition on cache device"):
|
||||
cache_disk = TestRun.disks["cache"]
|
||||
cache_disk.create_partitions([Size(400, Unit.MebiByte)])
|
||||
|
||||
with TestRun.step("Start and stop cache"):
|
||||
# Reload kernel modules
|
||||
cache = casadm.start_cache(
|
||||
cache_dev=cache_disk.partitions[0],
|
||||
cache_mode=cache_mode,
|
||||
cache_line_size=cache_line_size,
|
||||
cache_id=cache_id,
|
||||
force=True,
|
||||
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||
)
|
||||
cache.stop()
|
||||
|
||||
with TestRun.step("Prepare PeachFuzzer"):
|
||||
valid_values = [cache_disk.partitions[0].path.encode("ascii")]
|
||||
fuzz_config = get_device_fuzz_config([cache_disk.partitions[0].path])
|
||||
PeachFuzzer.generate_config(fuzz_config)
|
||||
base_cmd = start_cmd(cache_dev="{param}", load=True)
|
||||
commands = PeachFuzzer.get_fuzzed_command(
|
||||
command_template=base_cmd, count=TestRun.usr.fuzzy_iter_count
|
||||
)
|
||||
|
||||
for index, cmd in TestRun.iteration(
|
||||
enumerate(commands), f"Run command {TestRun.usr.fuzzy_iter_count} times"
|
||||
):
|
||||
with TestRun.step(f"Iteration {index + 1}"):
|
||||
output = run_cmd_and_validate(
|
||||
cmd=cmd,
|
||||
value_name="Device path",
|
||||
is_valid=cmd.param in valid_values,
|
||||
)
|
||||
if output.exit_code == 0:
|
||||
with TestRun.step("Stop cache"):
|
||||
casadm.stop_cache(cache_id=cache_id)
|
@ -0,0 +1,87 @@
|
||||
#
|
||||
# Copyright(c) 2022 Intel Corporation
|
||||
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import pytest
|
||||
|
||||
from api.cas import casadm
|
||||
from api.cas.cache_config import (
|
||||
CacheMode,
|
||||
CacheLineSize,
|
||||
UnalignedIo,
|
||||
KernelParameters,
|
||||
UseIoScheduler,
|
||||
)
|
||||
from api.cas.cli import start_cmd
|
||||
from core.test_run import TestRun
|
||||
from storage_devices.disk import DiskType, DiskTypeSet
|
||||
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||
from test_utils.size import Unit, Size
|
||||
from tests.security.fuzzy.kernel.common.common import (
|
||||
get_fuzz_config,
|
||||
run_cmd_and_validate,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||
def test_fuzzy_start_cache_mode(cache_line_size, unaligned_io, use_io_scheduler):
|
||||
"""
|
||||
title: Fuzzy test for casadm 'start cache' command – cache mode
|
||||
description: |
|
||||
Using Peach Fuzzer check Open CAS ability of handling wrong cache mode in
|
||||
'start cache' command.
|
||||
pass_criteria:
|
||||
- System did not crash
|
||||
- Open CAS still works.
|
||||
"""
|
||||
|
||||
cache_id = 1
|
||||
|
||||
with TestRun.step("Create partition on cache device"):
|
||||
cache_disk = TestRun.disks["cache"]
|
||||
cache_disk.create_partitions([Size(400, Unit.MebiByte)])
|
||||
|
||||
with TestRun.step("Start and stop cache"):
|
||||
# Reload kernel modules
|
||||
cache = casadm.start_cache(
|
||||
cache_dev=cache_disk.partitions[0],
|
||||
cache_mode=None,
|
||||
cache_line_size=cache_line_size,
|
||||
cache_id=cache_id,
|
||||
force=True,
|
||||
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||
)
|
||||
cache.stop()
|
||||
|
||||
with TestRun.step("Prepare PeachFuzzer"):
|
||||
valid_values = [e.name.encode("ascii").lower() for e in list(CacheMode)]
|
||||
fuzz_config = get_fuzz_config("cache_mode.yml")
|
||||
PeachFuzzer.generate_config(fuzz_config)
|
||||
base_cmd = start_cmd(
|
||||
cache_dev=cache_disk.partitions[0].path,
|
||||
cache_mode="{param}",
|
||||
cache_line_size=str(int(cache_line_size.value.get_value(Unit.KibiByte))),
|
||||
cache_id=str(cache_id),
|
||||
force=True,
|
||||
)
|
||||
commands = PeachFuzzer.get_fuzzed_command(
|
||||
command_template=base_cmd, count=TestRun.usr.fuzzy_iter_count
|
||||
)
|
||||
|
||||
for index, cmd in TestRun.iteration(
|
||||
enumerate(commands), f"Run command {TestRun.usr.fuzzy_iter_count} times"
|
||||
):
|
||||
with TestRun.step(f"Iteration {index + 1}"):
|
||||
output = run_cmd_and_validate(
|
||||
cmd=cmd,
|
||||
value_name="Cache line size",
|
||||
is_valid=cmd.param in valid_values,
|
||||
)
|
||||
if output.exit_code == 0:
|
||||
with TestRun.step("Stop cache"):
|
||||
casadm.stop_cache(cache_id=cache_id)
|
Loading…
Reference in New Issue
Block a user