Commit 01b3a954 authored by kinuthia's avatar kinuthia
Browse files

temporarily add 1s timeout to decoder test

decoder tests to run:
- decoder\test_decoder_constant_bitrate_no_binaural.py::test_decoder_combined_formats
parent 4cc4fde4
Loading
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -1080,18 +1080,18 @@ test-be-to-release:
    # test generating references
    - echo "generate references"

    # - ("& python -m pytest .\tests\codec_be_to_accepted_release\encoder --update_ref 1 -n $NPROC | tee 'logs/test_encoder-update_ref-log.txt'  ") | Invoke-Expression
    # - ("& python -m pytest .\tests\codec_be_to_accepted_release\encoder --update_ref 1 -n $NPROC 2>&1 | tee 'logs/test_encoder-update_ref-log.txt'  ") | Invoke-Expression
    # - If($LASTEXITCODE) {("exit $LASTEXITCODE") | Invoke-Expression}
    # - ("& python -m pytest .\tests\codec_be_to_accepted_release\decoder\test_decoder_constant_bitrate_no_binaural.py --update_ref 1 -n $NPROC -x | tee 'logs/test_decoder_constant_bitrate_no_binaural-update_ref-log.txt'  ") | Invoke-Expression
    # - ("& python -m pytest .\tests\codec_be_to_accepted_release\decoder\test_decoder_constant_bitrate_no_binaural.py --update_ref 1 -n $NPROC -x 2>&1 | tee 'logs/test_decoder_constant_bitrate_no_binaural-update_ref-log.txt'  ") | Invoke-Expression

    # temporarily test cases that fail

    # test_decoder_scenebased
    - ("& python -m pytest .\tests\codec_be_to_accepted_release\decoder\test_decoder_constant_bitrate_no_binaural.py::test_decoder_scenebased --update_ref 1 -n $NPROC | tee 'logs/test_decoder_constant_bitrate_no_binaural_test_decoder_scenebased-update_ref-log.txt'  ") | Invoke-Expression
    - If($LASTEXITCODE) {("exit $LASTEXITCODE") | Invoke-Expression}
    #- ("& python -m pytest .\tests\codec_be_to_accepted_release\decoder\test_decoder_constant_bitrate_no_binaural.py::test_decoder_scenebased --update_ref 1 -n $NPROC 2>&1 | tee 'logs/test_decoder_constant_bitrate_no_binaural_test_decoder_scenebased-update_ref-log.txt'  ") | Invoke-Expression
    #- If($LASTEXITCODE) {("exit $LASTEXITCODE") | Invoke-Expression}

    # test_decoder_combined_formats
    - ("& python -m pytest .\tests\codec_be_to_accepted_release\decoder\test_decoder_constant_bitrate_no_binaural.py::test_decoder_combined_formats --update_ref 1 -n $NPROC | tee 'logs/test_decoder_constant_bitrate_no_binaural_test_decoder_combined_formats-update_ref-log.txt'  ") | Invoke-Expression
    - ("& python -m pytest .\tests\codec_be_to_accepted_release\decoder\test_decoder_constant_bitrate_no_binaural.py::test_decoder_combined_formats --update_ref 1 -n $NPROC 2>&1 | tee 'logs/test_decoder_constant_bitrate_no_binaural_test_decoder_combined_formats-update_ref-log.txt'  ") | Invoke-Expression
    - If($LASTEXITCODE) {("exit $LASTEXITCODE") | Invoke-Expression}

  artifacts:
+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ def run_check(
        ref_bitstream,
        output_path,
        add_option_list=options,
        timeout=1,  # for testing,  to be reviewed
    )

    if not is_ref_creation and not is_be_to_ref(output_path):
+37 −24
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ import logging
from pathlib import Path
import platform
from subprocess import run
from subprocess import TimeoutExpired
import textwrap
from typing import Optional
import os
@@ -219,6 +220,7 @@ class EncoderFrontend:
        bypass_mode: Optional[int] = None,
        quiet_mode: Optional[bool] = True,
        add_option_list: Optional[list] = None,
        timeout: Optional[int] = None,
    ) -> None:
        command = [self._path]

@@ -252,7 +254,8 @@ class EncoderFrontend:
        cmd_str = textwrap.indent(" ".join(command), prefix="\t")
        log_dbg_msg(f"{self._type} encoder command:\n{cmd_str}")

        result = run(command, capture_output=True, check=False)
        try:
            result = run(command, capture_output=True, check=False, timeout=timeout)
            self.returncode = result.returncode
            self.stderr = result.stderr.decode("ascii")
            self.stdout = result.stdout.decode("ascii")
@@ -264,6 +267,10 @@ class EncoderFrontend:
                log_dbg_msg(f"{self._type} encoder stderr:\n{stderr_str}")
            if self.returncode:
                pytest.fail(f"{self._type} encoder terminated with a non-0 return code: {self.returncode}")
        except TimeoutExpired as err:
            log_dbg_msg(f"{self._type} encoder timed stdout:\n{err.stdout}")
            log_dbg_msg(f"{self._type} encoder timed stderr:\n{err.stderr}")
            pytest.fail(f"{self._type} encoder timed out")

    def _check_run(self):
        if self.returncode is not None:
@@ -360,6 +367,7 @@ class DecoderFrontend:
        quiet_mode: Optional[bool] = True,
        plc_file: Optional[Path] = None,
        add_option_list: Optional[list] = None,
        timeout: Optional[int] = None,
    ) -> None:
        command = [self._path]

@@ -386,7 +394,8 @@ class DecoderFrontend:
        cmd_str = textwrap.indent(" ".join(command), prefix="\t")
        log_dbg_msg(f"{self._type} decoder command:\n{cmd_str}")

        result = run(command, capture_output=True, check=False)
        try:
            result = run(command, capture_output=True, check=False, timeout=timeout)
            self.returncode = result.returncode
            self.stderr = result.stderr.decode("ascii")
            self.stdout = result.stdout.decode("ascii")
@@ -398,6 +407,10 @@ class DecoderFrontend:
                log_dbg_msg(f"{self._type} decoder stderr:\n{stderr_str}")
            if self.returncode:
                pytest.fail(f"{self._type} decoder terminated with a non-0 return code: {self.returncode}")
        except TimeoutExpired as err:
            log_dbg_msg(f"{self._type} decoder timed stdout:\n{err.stdout}")
            log_dbg_msg(f"{self._type} decoder timed stderr:\n{err.stderr}")
            pytest.fail(f"{self._type} decoder timed out")

    def _check_run(self):
        if self.returncode is not None: