From a71cfa510eaada71d2f8729bda99fc7d16e2a1fb Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 10 Jan 2025 12:37:59 +0100 Subject: [PATCH 1/3] add eid-xor and netsim command from test_param_File to logs --- .../test_param_file.py | 17 +++++++++++------ tests/conftest.py | 7 ++++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index 2d90309601..b1d0dfeeb5 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -43,7 +43,12 @@ import numpy as np from tests.cmp_pcm import cmp_pcm from tests.cmp_stats_files import cmp_stats_files -from tests.conftest import DecoderFrontend, EncoderFrontend, parse_properties +from tests.conftest import ( + DecoderFrontend, + EncoderFrontend, + parse_properties, + log_dbg_msg, +) from tests.testconfig import PARAM_FILE from tests.constants import ( MAX_ENC_FILE_LENGTH_DIFF, @@ -206,7 +211,6 @@ def test_param_file_tests( get_odg, compare_to_input, ): - enc_opts, dec_opts, sim_opts, eid_opts = param_file_test_dict[test_tag] run_test( @@ -267,7 +271,6 @@ def run_test( get_odg, compare_to_input, ): - # If compare_to_input is set, only run pass-through test cases if compare_to_input: passthrough = [ @@ -489,7 +492,6 @@ def run_test( ) if update_ref in [0, 2]: - # Output file names for comparison dut_output_file = f"{dut_base_path}/param_file/dec/{output_file}" ref_output_file = f"{reference_path}/param_file/dec/{output_file}" @@ -499,7 +501,6 @@ def run_test( odg_test = None odg_ref = None if get_odg: - # Find input format in_fmt = [(a, b) for (a, b) in INPUT_FMT if re.search(a, enc_opts)][0][1] @@ -763,7 +764,9 @@ def simulate( cmd_opts[3] = f"{dut_out_dir}/{netsim_tracefile}" cmd_opts[2] = f"{dut_out_dir}/{netsim_outfile}" # dut_out_file - run(netsim + cmd_opts, check=False) + netsim_cmd = netsim + cmd_opts + log_dbg_msg(f"netsim command:\n{" ".join(netsim_cmd)}") + run(netsim_cmd, check=False) def error_insertion( @@ -813,6 +816,8 @@ def error_insertion( elif update_ref in [0, 2]: cmd_opts[-1] = f"{dut_out_dir}/{eid_xor_outfile}" # ref_out_file + eid_cmd = eid_xor + cmd_opts + log_dbg_msg(f"eid-xor command:\n{" ".join(eid_cmd)}") run(eid_xor + cmd_opts, check=False) diff --git a/tests/conftest.py b/tests/conftest.py index c4795cb863..127f362f39 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -274,7 +274,7 @@ def pytest_addoption(parser): help="Compare output to the input file instead of reference output. N.B. Only applicable to pass-through tests.", default=False, ) - + @pytest.fixture(scope="session", autouse=True) def update_ref(request): @@ -387,11 +387,13 @@ def dut_encoder_path(request) -> str: return path + # fixture returns test information, enabling per-testcase SNR @pytest.fixture def test_info(request): return request + class EncoderFrontend: def __init__(self, path, enc_type, record_property, timeout=None) -> None: self._path = Path(path).absolute() @@ -755,7 +757,7 @@ class DecoderFrontend: cwd = Path(run_dir).absolute() eid_command_str = " ".join(eid_command) - log_dbg_msg(f"eid-xor command:\n {eid_command_str}") + log_dbg_msg(f"eid-xor command:\n{eid_command_str}") result = run(eid_command, check=True, cwd=cwd) except Exception as e: pytest.fail(f"eid-xor operation failed! - {e}") @@ -1052,7 +1054,6 @@ def compare_to_input(request) -> bool: return request.config.getoption("--compare_to_input") - def pytest_configure(config): config.addinivalue_line("markers", "serial: mark test to run only in serial") if config.option.param_file: -- GitLab From cf0f0aa41993e78a73adb3a5b8045a5463f47d61 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 10 Jan 2025 12:44:39 +0100 Subject: [PATCH 2/3] remove unnecessary blank --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 127f362f39..1e1cfa1b1d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -804,7 +804,7 @@ class DecoderFrontend: run(netsim_command, check=True, cwd=cwd) netsim_command_str = " ".join(netsim_command) - log_dbg_msg(f"netsim command:\n {netsim_command_str}") + log_dbg_msg(f"netsim command:\n{netsim_command_str}") except Exception as e: pytest.fail(f"netsim operation failed! - {e}") -- GitLab From ef645d0a48c73aa42ab0b3df92082c6595970c9b Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Fri, 10 Jan 2025 13:14:35 +0100 Subject: [PATCH 3/3] fix f strings --- tests/codec_be_on_mr_nonselection/test_param_file.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/codec_be_on_mr_nonselection/test_param_file.py b/tests/codec_be_on_mr_nonselection/test_param_file.py index b1d0dfeeb5..5a9c86675c 100644 --- a/tests/codec_be_on_mr_nonselection/test_param_file.py +++ b/tests/codec_be_on_mr_nonselection/test_param_file.py @@ -765,7 +765,8 @@ def simulate( cmd_opts[2] = f"{dut_out_dir}/{netsim_outfile}" # dut_out_file netsim_cmd = netsim + cmd_opts - log_dbg_msg(f"netsim command:\n{" ".join(netsim_cmd)}") + netsim_cmd_str = " ".join(netsim_cmd) + log_dbg_msg(f"netsim command:\n{netsim_cmd_str}") run(netsim_cmd, check=False) @@ -817,7 +818,8 @@ def error_insertion( cmd_opts[-1] = f"{dut_out_dir}/{eid_xor_outfile}" # ref_out_file eid_cmd = eid_xor + cmd_opts - log_dbg_msg(f"eid-xor command:\n{" ".join(eid_cmd)}") + eid_cmd_str = " ".join(eid_cmd) + log_dbg_msg(f"eid-xor command:\n{eid_cmd_str}") run(eid_xor + cmd_opts, check=False) -- GitLab