Commit eb96c3a4 authored by norvell's avatar norvell
Browse files

Add check for run errors in renderer tests

parent 406569eb
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -409,9 +409,13 @@ def dut_encoder_path(request) -> str:


# fixture returns test information, enabling per-testcase SNR
@pytest.fixture
@pytest.fixture(scope="function")
def test_info(request):
    return request
    yield request

    # Check for errors during teardown to report error instead of failure
    if hasattr(request, "error"):
        pytest.fail(request.error)


class EncoderFrontend:
+7 −8
Original line number Diff line number Diff line
@@ -64,14 +64,13 @@ from ..cmp_pcm import cmp_pcm
from ..conftest import parse_properties


def run_cmd(cmd, env=None):
def run_cmd(cmd, test_info, env=None):
    logging.info(f"\nRunning command\n{' '.join(cmd)}\n")
    try:
        sp.run(cmd, check=True, capture_output=True, text=True, env=env)
    except sp.CalledProcessError as e:
        raise SystemError(
            f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
        )
        test_info.error = f"Command returned non-zero exit status ({e.returncode}): {' '.join(e.cmd)}\n{e.stderr}\n{e.stdout}"
        raise SystemError(test_info.error)


def run_isar_ext_rend_cmd(cmd, env=None):
@@ -309,7 +308,7 @@ def run_renderer(
        )

    # run the renderer
    run_cmd(cmd, env)
    run_cmd(cmd, test_info, env)

    if test_info.config.option.create_cut and not render_for_peaq:
        # CUT creation mode will run a comparison with REF
@@ -349,12 +348,12 @@ def run_renderer(
                    cmd2[0] += binary_suffix
                    if "MASA" in str(out_fmt):
                        cmd2.extend(["-im", out_file + ".met"])
                    run_cmd(cmd2, env)
                    run_cmd(cmd2, test_info, env)

                    # Render ref to BINAURAL with same settings as test
                    cmd2[2] = str(out_file_ref)  # in_file
                    cmd2[6] = odg_ref            # out_file
                    run_cmd(cmd2, env)
                    run_cmd(cmd2, test_info, env)
                    out_fmt_bin = new_fmt
            else:
                out_fmt_bin = out_fmt
@@ -367,7 +366,7 @@ def run_renderer(
                cmd[0] += binary_suffix
                cmd[6] = odg_input       # out_file
                cmd[8] = out_fmt_bin     # out_fmt
                run_cmd(cmd, env)
                run_cmd(cmd, test_info, env)
            else:
                odg_input = in_file