From c27c5f9429a371d855980acd806dea8512b4a551 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 18 May 2026 14:11:19 +0200 Subject: [PATCH 1/2] tests: add --{ref,dut}_renderer_path args to pytest --- tests/conftest.py | 70 +++++++++++++++++++++++++++++++++++++++++ tests/renderer/utils.py | 31 +++++++++++++----- 2 files changed, 93 insertions(+), 8 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index edfb77e7d..a5601e564 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -152,6 +152,18 @@ def pytest_addoption(parser): help="If specified, use given binary as REF ISAR post-renderer.", ) + parser.addoption( + "--dut_renderer_path", + action="store", + help="If specified, use given binary as DUT renderer.", + ) + + parser.addoption( + "--ref_renderer_path", + action="store", + help="If specified, use given binary as REF renderer.", + ) + parser.addoption( "--test_vector_path", action="store", @@ -1544,3 +1556,61 @@ def ref_postrend_frontend(ref_postrend_path, request) -> Optional[PostRendFronte # Fixture teardown if postrend is not None: postrend._check_run() + + +@pytest.fixture(scope="session") +def dut_renderer_path(request) -> Optional[str]: + """ + Return path of DUT renderer binary. + """ + if request.config.option.dut_renderer_path: + return request.config.option.dut_renderer_path + + if request.config.option.create_ref: + return None + + here = Path(__file__).parent.resolve() + system = platform.system() + + if system == "Windows": + path = here.joinpath("../IVAS_rend.exe") + elif system in ["Darwin", "Linux"]: + path = here.joinpath("../IVAS_rend") + else: + raise ValueError(f'Wrong system "{system}"!') + + path = str(path.resolve()) + + if not os.path.isfile(path): + raise FileNotFoundError(f"DUT renderer binary {path} not found!\n!") + + return path + + +@pytest.fixture(scope="session") +def ref_renderer_path(request) -> Optional[str]: + """ + Return path of REF renderer binary. + """ + if request.config.option.ref_renderer_path: + return request.config.option.ref_renderer_path + + if not request.config.option.create_ref: + return None + + here = Path(__file__).parent.resolve() + system = platform.system() + + if system == "Windows": + path = here.joinpath("../IVAS_rend_ref.exe") + elif system in ["Darwin", "Linux"]: + path = here.joinpath("../IVAS_rend_ref") + else: + raise ValueError(f'Wrong system "{system}"!') + + path = str(path.resolve()) + + if not os.path.isfile(path): + raise FileNotFoundError(f"REF renderer binary {path} not found!\n!") + + return path diff --git a/tests/renderer/utils.py b/tests/renderer/utils.py index f133f7dc2..83ad42f9b 100644 --- a/tests/renderer/utils.py +++ b/tests/renderer/utils.py @@ -295,9 +295,18 @@ def run_renderer( cmd[8] = str(out_fmt) cmd[10] = str(sr[:2]) - if test_info.config.option.create_ref: - cmd[0] += BIN_SUFFIX_MERGETARGET - cmd[0] += binary_suffix + if test_info.config.option.create_ref or render_for_peaq: + explicit_path = test_info.config.getoption("--ref_renderer_path") + if explicit_path is not None: + cmd[0] = explicit_path + else: + cmd[0] += BIN_SUFFIX_MERGETARGET + binary_suffix + else: + explicit_path = test_info.config.getoption("--dut_renderer_path") + if explicit_path is not None: + cmd[0] = explicit_path + else: + cmd[0] += binary_suffix if in_meta_files is not None: cmd.extend(["-im", *in_meta_files]) @@ -384,8 +393,11 @@ def run_renderer( cmd2[6] = odg_test # out_file cmd2[8] = new_fmt # out_fmt cmd2[10] = str(sr[:2]) - cmd2[0] += BIN_SUFFIX_MERGETARGET # Use IVAS_rend_ref for re-rendering - cmd2[0] += binary_suffix + ref_path = test_info.config.getoption("--ref_renderer_path") + if ref_path is not None: + cmd2[0] = ref_path + else: + cmd2[0] += BIN_SUFFIX_MERGETARGET + binary_suffix if "MASA" in str(out_fmt): cmd2.extend(["-im", out_file + ".met"]) run_cmd(cmd2, test_info, env) @@ -402,8 +414,11 @@ def run_renderer( if out_fmt_bin != in_fmt: # Render input to match out_fmt_bin using same config as input, but with IVAS_rend_ref - cmd[0] += BIN_SUFFIX_MERGETARGET - cmd[0] += binary_suffix + ref_path = test_info.config.getoption("--ref_renderer_path") + if ref_path is not None: + cmd[0] = ref_path + else: + cmd[0] = RENDERER_CMD[0] + BIN_SUFFIX_MERGETARGET + binary_suffix cmd[6] = odg_input # out_file cmd[8] = out_fmt_bin # out_fmt run_cmd(cmd, test_info, env) @@ -646,7 +661,7 @@ def binauralize_input_and_output( # Rendering configuration config_file = findstr(r"-render_config\s+(\S+)", dec_opts) - binary_suffix = "_ref" + binary_suffix = "" frame_size = findstr(r"-fr\s+(\S+)", dec_opts) # hrtf_file = findstr(r'-hrtf\s+(\S+)', dec_opts) hrtf_file = None # Default HRTFs used for binaural rendering of output -- GitLab From dccaa1b6d16cbd0d5aabbb39959ee3815ba989a9 Mon Sep 17 00:00:00 2001 From: Jan Kiene Date: Mon, 18 May 2026 14:12:03 +0200 Subject: [PATCH 2/2] cleanup: remove unused import in conftest.py --- tests/conftest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index a5601e564..26ae057c2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -45,7 +45,7 @@ from subprocess import TimeoutExpired, run from tempfile import NamedTemporaryFile from shutil import move import tempfile -from typing import Optional, Union, List +from typing import Optional, Union import numpy as np from _pytest.outcomes import Skipped, Failed from .constants import ( -- GitLab