Commit 8d8e6e0d authored by Jan Kiene's avatar Jan Kiene
Browse files

add first experiment with "-reduced" cmdl option

random subsampling for now, do it smarter later
parent 5bff4cd2
Loading
Loading
Loading
Loading
+21 −7
Original line number Diff line number Diff line
@@ -28,7 +28,8 @@ accordance with the laws of the Federal Republic of Germany excluding its confli
the United Nations Convention on Contracts on the International Sales of Goods.
"""

import pytest
import itertools
import random
from ..constants import (
    ISM_MD_NULL,
    ISM_MD_EXTENDED,
@@ -45,7 +46,7 @@ from . import get_options, run_check
from .. import get_testv_path, get_valid_fs_max_band_pairs


TEST_PARAMS = {
TEST_PARAMS_EXHAUSTIVE = {
    "test_encoder_const_br_channel_based_and_masa_modes": (
        "input_format,bitrate,dtx",
        ENCODER_CHANNEL_BASED_AND_MASA_PARAMS,
@@ -62,14 +63,27 @@ TEST_PARAMS = {
    ),
}

N_PARAMS = {t: n for t, n in zip(TEST_PARAMS_EXHAUSTIVE.keys(), [40] * 5)}


def pytest_generate_tests(metafunc):
    # NOTE: this excludes narrow-band modes for stereo_dmx_evs as those are not really IVAS but EVS and implementation is complicated...
    fs_mb_params = get_valid_fs_max_band_pairs()
    metafunc.parametrize("sampling_rate,max_band", fs_mb_params)

    func_name = metafunc.function.__name__
    param_string, params = TEST_PARAMS[func_name]
    param_string_fs_mb = "sampling_rate,max_band"
    fs_mb_params = get_valid_fs_max_band_pairs()
    param_string, params = TEST_PARAMS_EXHAUSTIVE[func_name]

    if metafunc.config.getoption("reduced"):
        # randomly choose lower number of parameters
        random.seed("IVAAAAS")
        param_string = ",".join([param_string, param_string_fs_mb])
        combined_params = [p[0] + p[1] for p in itertools.product(params, fs_mb_params)]
        metafunc.parametrize(
            param_string, random.sample(combined_params, N_PARAMS[func_name])
        )
    else:
        # NOTE: this excludes narrow-band modes for stereo_dmx_evs as those are not really IVAS but EVS and implementation is complicated...
        metafunc.parametrize(param_string_fs_mb, fs_mb_params)
        metafunc.parametrize(param_string, params)


+2 −0
Original line number Diff line number Diff line
@@ -147,6 +147,8 @@ def pytest_addoption(parser):
        help="Path to file with md5 sums for the reference signals of the selection-BE test"
    )

    parser.addoption("--reduced", action="store_true", help="Flag for running the allpairs-reduced version of the long BE test")


@pytest.fixture(scope="session", autouse=True)
def update_ref(request):