Skip to content

Commit

Permalink
pyocf: disable test debug logs by default
Browse files Browse the repository at this point in the history
New commandline switch --debug-log and associated debug_log fixture
is added to enable debug logs on demand.

Signed-off-by: Adam Rutkowski <[email protected]>
  • Loading branch information
Adam Rutkowski committed May 9, 2022
1 parent 50bff02 commit 3a604b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions tests/functional/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,12 @@ def pyocf_ctx_log_buffer():
yield logger
c.exit()
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")
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 @@ -192,7 +192,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 @@ -348,7 +348,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

0 comments on commit 3a604b8

Please sign in to comment.