Commit cfd9a01f authored by Jan Kiene's avatar Jan Kiene
Browse files

add tracefile comparison for JBM cases

parent c3c5d667
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -40,6 +40,7 @@ import platform
from pathlib import Path
from subprocess import run
import pytest
import numpy as np

from tests.cmp_pcm import cmp_pcm
from tests.conftest import DecoderFrontend, EncoderFrontend
@@ -316,6 +317,16 @@ def test_param_file_tests(
    if update_ref in [0, 2]:
        dut_output_file = f"{dut_base_path}/param_file/dec/{output_file}"
        ref_output_file = f"{reference_path}/param_file/dec/{output_file}"
        dut_tracefile_dec = f"{dut_base_path}/param_file/dec/{tracefile_dec}"
        ref_tracefile_dec = f"{reference_path}/param_file/dec/{tracefile_dec}"

        # set to false per default even if this is no JBM case - makes later check for failure easier
        tracefile_lengths_differ = False
        if len(tracefile_dec) > 0:
            dut_tracefile_len = np.genfromtxt(dut_tracefile_dec, delimiter=";")
            ref_tracefile_len = np.genfromtxt(ref_tracefile_dec, delimiter=";")
            tracefile_lengths_differ = dut_tracefile_len.shape[0] != ref_tracefile_len.shape[0]

        fs = int(sampling_rate) * 1000
        output_differs, reason = cmp_pcm(
            dut_output_file,
@@ -358,7 +369,9 @@ def test_param_file_tests(
                    print("REF output metadata missing for expected file: " + md_file)
                metadata_differs = True

        if get_mld and get_mld_lim > 0:
        if tracefile_lengths_differ:
            pytest.fail("Different tracefile lengths for JBM decoding - Not all frames were decoded in both ref and dut.")
        elif get_mld and get_mld_lim > 0:
            if output_differs:
                pytest.fail(reason)
        else: