Fuzzy tests for casadm 'get param' command
Signed-off-by: Katarzyna Treder <katarzyna.treder@h-partners.com>
This commit is contained in:
parent
1861758c6a
commit
b8364ea593
@ -0,0 +1,4 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
@ -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.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.cli import get_param_cleaning_acp_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_cleaning_acp_cache_id(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for cleaning-acp parameters - cache id.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong cache id in 'get parameter'
|
||||||
|
for cleaning-acp command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [str(core.cache_id).encode("ascii")]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("cache_id.yml"))
|
||||||
|
base_cmd = get_param_cleaning_acp_cmd(cache_id="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Cache id",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,89 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.casadm_params import OutputFormat
|
||||||
|
from api.cas.cli import get_param_cleaning_acp_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_cleaning_acp_output_format(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: |
|
||||||
|
Fuzzy test for casadm 'get parameter' command for cleaning-acp parameters – output format.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong output format in
|
||||||
|
'get parameter' for cleaning-acp command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [e.name.encode("ascii") for e in list(OutputFormat)]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("output_format.yml"))
|
||||||
|
base_cmd = get_param_cleaning_acp_cmd(cache_id=str(core.cache_id), output_format="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Output format",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -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.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.cli import get_param_cleaning_alru_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_cleaning_alru_cache_id(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for cleaning-alru parameters – cache id.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong cache id in 'get parameter'
|
||||||
|
for cleaning-alru command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [str(core.cache_id).encode("ascii")]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("cache_id.yml"))
|
||||||
|
base_cmd = get_param_cleaning_alru_cmd(cache_id="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Cache id",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,91 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.casadm_params import OutputFormat
|
||||||
|
from api.cas.cli import get_param_cleaning_alru_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_cleaning_alru_output_format(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: |
|
||||||
|
Fuzzy test for casadm 'get parameter' command for cleaning-alru parameters – output format.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong output format in
|
||||||
|
'get parameter' for cleaning-alru command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [e.name.encode("ascii") for e in list(OutputFormat)]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("output_format.yml"))
|
||||||
|
base_cmd = get_param_cleaning_alru_cmd(
|
||||||
|
cache_id=str(core.cache_id),
|
||||||
|
output_format="{param}",
|
||||||
|
)
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Output format",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -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.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.cli import get_param_cleaning_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_cleaning_cache_id(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for cleaning parameters – cache id.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong cache id in
|
||||||
|
'get parameter' command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [str(core.cache_id).encode("ascii")]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("cache_id.yml"))
|
||||||
|
base_cmd = get_param_cleaning_cmd(cache_id="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Cache id",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,88 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.casadm_params import OutputFormat
|
||||||
|
from api.cas.cli import get_param_cleaning_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_cleaning_output_format(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for cleaning parameters – output format.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong output format
|
||||||
|
in 'get parameter' command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [e.name.encode("ascii") for e in list(OutputFormat)]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("output_format.yml"))
|
||||||
|
base_cmd = get_param_cleaning_cmd(cache_id=str(core.cache_id), output_format="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Output format",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,96 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.casadm_params import ParamName
|
||||||
|
from api.cas.cli import _get_param_cmd, casadm_bin
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
get_cmd,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex(
|
||||||
|
"cache_mode",
|
||||||
|
CacheMode.with_any_trait(CacheModeTrait.InsertRead | CacheModeTrait.InsertWrite),
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_name(cache_mode, cache_line_size, unaligned_io, use_io_scheduler):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command – name parameter.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong name
|
||||||
|
in 'get parameter' command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- OpenCAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Make filesystem on CAS device and run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer to create 'get parameter' command and run it."):
|
||||||
|
valid_values = [e.value for e in list(ParamName)]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("param_name.yml"))
|
||||||
|
parameters = PeachFuzzer.generate_peach_fuzzer_parameters(TestRun.usr.fuzzy_iter_count)
|
||||||
|
base_cmd = casadm_bin + _get_param_cmd(name="{param}", cache_id=str(core.cache_id))
|
||||||
|
|
||||||
|
for index, parameter in TestRun.iteration(
|
||||||
|
enumerate(parameters), f"Run command {TestRun.usr.fuzzy_iter_count} times"
|
||||||
|
):
|
||||||
|
with TestRun.step(f"Iteration {index + 1}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
param = parameter.decode("ascii", "ignore").rstrip()
|
||||||
|
cmd = base_cmd
|
||||||
|
# for name seq-cutoff there is additional parameter required (core-id)
|
||||||
|
if param == str(ParamName.seq_cutoff):
|
||||||
|
cmd += f" --core-id {core.core_id}"
|
||||||
|
|
||||||
|
cmd = base_cmd.replace("{param}", param)
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=get_cmd(cmd, param.encode("ascii")),
|
||||||
|
value_name="Name",
|
||||||
|
is_valid=param in valid_values,
|
||||||
|
)
|
@ -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.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.cli import get_param_promotion_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_promotion_cache_id(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for promotion policy – cache id.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong cache id in 'get parameter'
|
||||||
|
command for promotion policy.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [str(core.cache_id).encode("ascii")]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("cache_id.yml"))
|
||||||
|
base_cmd = get_param_promotion_cmd(cache_id="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Cache id",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -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.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.cli import get_param_promotion_nhit_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_promotion_nhit_cache_id(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for nhit promotion policy – cache id.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong cache id in 'get parameter'
|
||||||
|
command for nhit promotion policy.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [str(core.cache_id).encode("ascii")]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("cache_id.yml"))
|
||||||
|
base_cmd = get_param_promotion_nhit_cmd(cache_id="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Cache id",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,88 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.casadm_params import OutputFormat
|
||||||
|
from api.cas.cli import get_param_promotion_nhit_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_promotion_nhit_output_format(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for nhit promotion policy – output format.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong output format in 'get parameter'
|
||||||
|
command for nhit promotion policy.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [e.name.encode("ascii") for e in list(OutputFormat)]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("output_format.yml"))
|
||||||
|
base_cmd = get_param_promotion_nhit_cmd(cache_id=str(core.cache_id), output_format="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Output format",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,88 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.casadm_params import OutputFormat
|
||||||
|
from api.cas.cli import get_param_promotion_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex("cache_mode", CacheMode.with_traits(CacheModeTrait.LazyWrites))
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_promotion_output_format(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for promotion policy – output format.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong output format
|
||||||
|
in 'get parameter' command for promotion policy.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- Open CAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer create 'get parameter' command and run it."):
|
||||||
|
valid_values = [e.name.encode("ascii") for e in list(OutputFormat)]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("output_format.yml"))
|
||||||
|
base_cmd = get_param_promotion_cmd(cache_id=str(core.cache_id), output_format="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Output format",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,90 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.cli import get_param_cutoff_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex(
|
||||||
|
"cache_mode",
|
||||||
|
CacheMode.with_any_trait(CacheModeTrait.InsertRead | CacheModeTrait.InsertWrite),
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_seq_cutoff_cache_id(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for sequential cutoff – cache id.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong cache id in 'get parameter'
|
||||||
|
for sequential cutoff command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- OpenCAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Make filesystem on CAS device and run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer to create 'get parameter' command and run it."):
|
||||||
|
valid_values = [str(core.cache_id).encode("ascii")]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("cache_id.yml"))
|
||||||
|
base_cmd = get_param_cutoff_cmd(cache_id="{param}", core_id=str(core.core_id))
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Cache id",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -0,0 +1,90 @@
|
|||||||
|
#
|
||||||
|
# Copyright(c) 2022 Intel Corporation
|
||||||
|
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
|
||||||
|
# SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
#
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from api.cas.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.cli import get_param_cutoff_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex(
|
||||||
|
"cache_mode",
|
||||||
|
CacheMode.with_any_trait(CacheModeTrait.InsertRead | CacheModeTrait.InsertWrite),
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_seq_cutoff_core_id(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for sequential cutoff – core id.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong core id in 'get parameter'
|
||||||
|
for sequential cutoff command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- OpenCAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Make filesystem on CAS device and run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer to create 'get parameter' command and run it."):
|
||||||
|
valid_values = [str(core.core_id).encode("ascii")]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("core_id.yml"))
|
||||||
|
base_cmd = get_param_cutoff_cmd(cache_id=str(core.cache_id), core_id="{param}")
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Core id",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
@ -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.cache_config import (
|
||||||
|
CacheLineSize,
|
||||||
|
CacheMode,
|
||||||
|
KernelParameters,
|
||||||
|
UnalignedIo,
|
||||||
|
UseIoScheduler,
|
||||||
|
CacheModeTrait,
|
||||||
|
)
|
||||||
|
from api.cas.casadm_params import OutputFormat
|
||||||
|
from api.cas.cli import get_param_cutoff_cmd
|
||||||
|
from core.test_run import TestRun
|
||||||
|
from storage_devices.disk import DiskType, DiskTypeLowerThan, DiskTypeSet
|
||||||
|
from test_tools.peach_fuzzer.peach_fuzzer import PeachFuzzer
|
||||||
|
from tests.security.fuzzy.kernel.common.common import (
|
||||||
|
get_fuzz_config,
|
||||||
|
prepare_cas_instance,
|
||||||
|
run_cmd_and_validate,
|
||||||
|
)
|
||||||
|
from tests.security.fuzzy.kernel.fuzzy_with_io.common.common import (
|
||||||
|
get_basic_workload,
|
||||||
|
mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
|
||||||
|
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
|
||||||
|
@pytest.mark.parametrizex(
|
||||||
|
"cache_mode",
|
||||||
|
CacheMode.with_any_trait(CacheModeTrait.InsertRead | CacheModeTrait.InsertWrite),
|
||||||
|
)
|
||||||
|
@pytest.mark.parametrizex("cache_line_size", CacheLineSize)
|
||||||
|
@pytest.mark.parametrizex("unaligned_io", UnalignedIo)
|
||||||
|
@pytest.mark.parametrizex("use_io_scheduler", UseIoScheduler)
|
||||||
|
def test_fuzzy_get_param_seq_cutoff_output_format(
|
||||||
|
cache_mode, cache_line_size, unaligned_io, use_io_scheduler
|
||||||
|
):
|
||||||
|
"""
|
||||||
|
title: Fuzzy test for casadm 'get parameter' command for sequential cutoff – output format.
|
||||||
|
description: |
|
||||||
|
Using Peach Fuzzer check Open CAS ability of handling wrong output format
|
||||||
|
in 'get parameter' for sequential cutoff command.
|
||||||
|
pass_criteria:
|
||||||
|
- System did not crash
|
||||||
|
- OpenCAS still works.
|
||||||
|
"""
|
||||||
|
with TestRun.step("Start cache and add core device"):
|
||||||
|
cache_disk = TestRun.disks["cache"]
|
||||||
|
core_disk = TestRun.disks["core"]
|
||||||
|
cache, core = prepare_cas_instance(
|
||||||
|
kernel_params=KernelParameters(unaligned_io, use_io_scheduler),
|
||||||
|
cache_device=cache_disk,
|
||||||
|
core_device=core_disk,
|
||||||
|
cache_mode=cache_mode,
|
||||||
|
cache_line_size=cache_line_size,
|
||||||
|
mount_point=mount_point,
|
||||||
|
)
|
||||||
|
|
||||||
|
with TestRun.step("Make filesystem on CAS device and run FIO in background"):
|
||||||
|
fio = get_basic_workload(mount_point)
|
||||||
|
fio_pid = fio.run_in_background()
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
with TestRun.step("Using Peach Fuzzer to create 'get parameter' command and run it."):
|
||||||
|
valid_values = [e.name.encode("ascii") for e in list(OutputFormat)]
|
||||||
|
PeachFuzzer.generate_config(get_fuzz_config("output_format.yml"))
|
||||||
|
base_cmd = get_param_cutoff_cmd(
|
||||||
|
cache_id=str(core.cache_id),
|
||||||
|
core_id=str(core.core_id),
|
||||||
|
output_format="{param}",
|
||||||
|
)
|
||||||
|
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}"):
|
||||||
|
if not TestRun.executor.check_if_process_exists(fio_pid):
|
||||||
|
raise Exception("Fio is not running.")
|
||||||
|
|
||||||
|
run_cmd_and_validate(
|
||||||
|
cmd=cmd,
|
||||||
|
value_name="Output format",
|
||||||
|
is_valid=cmd.param in valid_values,
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user