Commit 3da5641d authored by TYAGIRIS's avatar TYAGIRIS
Browse files

fix sba pytests with dtx on

parent 023ae9a5
Loading
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@ import re
import platform
from pathlib import Path
from subprocess import run

import tempfile
import pytest

from tests.cmp_pcm import cmp_pcm
@@ -173,7 +173,7 @@ def test_param_file_tests(
        and Path(testv_file).name.startswith("stv")
    ):
        sba_br_switching_dtx = 1
        cut_file = pre_proc_input(testv_file, fs)
        cut_file, cut_file_pre_exist = pre_proc_input(testv_file, fs)
        testv_file = cut_file

    # bitrate can be a filename: remove leading "../"
@@ -204,7 +204,7 @@ def test_param_file_tests(
        )
    if sba_br_switching_dtx == 1 and not keep_files:
        is_exist = os.path.exists(cut_file)
        if is_exist:
        if is_exist and cut_file_pre_exist == 0:
            os.remove(cut_file)

    # check for networkSimulator_g192 command line
@@ -462,8 +462,14 @@ def pre_proc_input(testv_file, fs):
    elif "stv3OA" in testv_file:
        num_channel = "16"
    cut_file = testv_file.replace(".wav", num_channel + "chn_" + cut_gain + ".wav")
    cut_file_pre_exist = 1;
    if not os.path.exists(cut_file):
        tmpf = tempfile.TemporaryFile()
        cut_file = tmpf.name + num_channel + "chn_" + cut_gain + ".wav"
        cut_file_pre_exist = 0;
    
    cut_samples(testv_file, cut_file, num_channel, cut_from, cut_len, cut_gain)
    return cut_file
    return cut_file, cut_file_pre_exist


def simulate(
+8 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ __doc__ = """
import errno
import os
import re
import tempfile

import pytest
from cut_bs import cut_from_start
@@ -586,6 +587,13 @@ def sba_enc(
        else:
            cut_file = f"{test_vector_path}/{tag_in}_cut_{cut_gain}{in_extension}"
        if not os.path.exists(cut_file):
            tmpf = tempfile.TemporaryFile()
            cut_file = tmpf.name
            if cut_gain == "1.0":
                cut_file += f"{tag_in}_cut{in_extension}"
            else:
                cut_file += f"{tag_in}_cut_{cut_gain}{in_extension}"          
 
            cut_samples(
                input_path,
                cut_file,