Skip to content

Commit 3a604b8

Browse files
author
Adam Rutkowski
committed
pyocf: disable test debug logs by default
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]>
1 parent 50bff02 commit 3a604b8

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

Diff for: tests/functional/tests/conftest.py

+9
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,12 @@ def pyocf_ctx_log_buffer():
4646
yield logger
4747
c.exit()
4848
gc.collect()
49+
50+
51+
def pytest_addoption(parser):
52+
parser.addoption("--debug-log", action="store_true", help="enable debug logs")
53+
54+
55+
@pytest.fixture
56+
def debug_log(request):
57+
return request.config.getoption("--debug-log")

Diff for: tests/functional/tests/engine/test_read.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def print_test_case(
192192
@pytest.mark.parametrize("cacheline_size", CacheLineSize)
193193
@pytest.mark.parametrize("cache_mode", CacheMode)
194194
@pytest.mark.parametrize("rand_seed", [datetime.now()])
195-
def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode, rand_seed):
195+
def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode, rand_seed, debug_log):
196196
CACHELINE_COUNT = 9
197197
SECTOR_SIZE = Size.from_sector(1).B
198198
CLS = cacheline_size // SECTOR_SIZE
@@ -348,7 +348,8 @@ def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode, rand_seed)
348348

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

353354
# issue read
354355
START = start * SECTOR_SIZE

0 commit comments

Comments
 (0)