Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pyocf: disable test debug logs by default #711

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions tests/functional/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,15 @@ def pyocf_ctx_log_buffer():
gc.collect()


def pytest_addoption(parser):
parser.addoption("--debug-log", action="store_true", help="enable debug logs")


@pytest.fixture
def debug_log(request):
return request.config.getoption("--debug-log")


Comment on lines +47 to +55
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pytest already has it's own log level setting. Any chance to use it instead of introducing additional adoption?

@pytest.fixture()
def pyocf_2_ctx():
c1 = OcfCtx.with_defaults(DefaultLogger(LogLevel.WARN, "Ctx1"))
Expand Down
5 changes: 3 additions & 2 deletions tests/functional/tests/engine/test_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ def print_test_case(
@pytest.mark.parametrize("cacheline_size", CacheLineSize)
@pytest.mark.parametrize("cache_mode", CacheMode)
@pytest.mark.parametrize("rand_seed", [datetime.now()])
def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode, rand_seed):
def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode, rand_seed, debug_log):
CACHELINE_COUNT = 9
SECTOR_SIZE = Size.from_sector(1).B
CLS = cacheline_size // SECTOR_SIZE
Expand Down Expand Up @@ -340,7 +340,8 @@ def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode, rand_seed)

# run the test for each selected IO range for currently set up region status
for start, end in io_ranges:
print_test_case(region_start, region_state, start, end, SECTOR_COUNT, CLS)
if debug_log:
print_test_case(region_start, region_state, start, end, SECTOR_COUNT, CLS)

# issue read
START = start * SECTOR_SIZE
Expand Down