From 36cb683f19b876d7ca50203ea2d5884b27b0d931 Mon Sep 17 00:00:00 2001 From: Adam Rutkowski Date: Mon, 9 May 2022 16:07:40 +0200 Subject: [PATCH] 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 Signed-off-by: Robert Baldyga --- tests/functional/tests/conftest.py | 9 +++++++++ tests/functional/tests/engine/test_read.py | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/functional/tests/conftest.py b/tests/functional/tests/conftest.py index 6b39d68d..8dee9063 100644 --- a/tests/functional/tests/conftest.py +++ b/tests/functional/tests/conftest.py @@ -105,3 +105,12 @@ def pyocf_2_ctx_log_buffer(request): return if len(Volume._instances_) > 0: warnings.warn("Not all Volumes have been closed!!!") + + +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") diff --git a/tests/functional/tests/engine/test_read.py b/tests/functional/tests/engine/test_read.py index b28e38a0..df88afd5 100644 --- a/tests/functional/tests/engine/test_read.py +++ b/tests/functional/tests/engine/test_read.py @@ -186,7 +186,7 @@ def print_test_case( @pytest.mark.parametrize("cacheline_size", CacheLineSize) @pytest.mark.parametrize("cache_mode", CacheMode) -def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode): +def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode, debug_log): CACHELINE_COUNT = 9 SECTOR_SIZE = Size.from_sector(1).B CLS = cacheline_size // SECTOR_SIZE @@ -340,7 +340,8 @@ def test_read_data_consistency(pyocf_ctx, cacheline_size, cache_mode): # 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