Commit 5c66683e authored by norvell's avatar norvell
Browse files

Adding test_26444.py to be used in BASOP CI

parent 7fe4c29b
Loading
Loading
Loading
Loading
Loading

tests/test_26444.py

0 → 100644
+94 −0
Original line number Diff line number Diff line
__copyright__ = """
(C) 2022-2023 IVAS codec Public Collaboration with portions copyright Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
contributors to this repository. All Rights Reserved.

This software is protected by copyright law and by international treaties.
The IVAS codec Public Collaboration consisting of Dolby International AB, Ericsson AB,
Fraunhofer-Gesellschaft zur Foerderung der angewandten Forschung e.V., Huawei Technologies Co. LTD.,
Koninklijke Philips N.V., Nippon Telegraph and Telephone Corporation, Nokia Technologies Oy, Orange,
Panasonic Holdings Corporation, Qualcomm Technologies, Inc., VoiceAge Corporation, and other
contributors to this repository retain full ownership rights in their respective contributions in
the software. This notice grants no license of any kind, including but not limited to patent
license, nor is any license granted by implication, estoppel or otherwise.

Contributors are required to enter into the IVAS codec Public Collaboration agreement before making
contributions.

This software is provided "AS IS", without any express or implied warranties. The software is in the
development stage. It is intended exclusively for experts who have experience with such software and
solely for the purpose of inspection. All implied warranties of non-infringement, merchantability
and fitness for a particular purpose are hereby disclaimed and excluded.

Any dispute, controversy or claim arising under or in relation to providing this software shall be
submitted to and settled by the final, binding jurisdiction of the courts of Munich, Germany in
accordance with the laws of the Federal Republic of Germany excluding its conflict of law rules and
the United Nations Convention on Contracts on the International Sales of Goods.
"""

__doc__ = """
Execute tests specified via a parameter file.
"""

import os
from pathlib import Path
import filecmp
import subprocess
import pytest

test_dict = {}
TEST_DIR = "evs_be_test" 
scripts=["Readme_AMRWB_IO_dec.txt", "Readme_AMRWB_IO_enc.txt", "Readme_EVS_dec.txt","Readme_EVS_enc.txt", "Readme_JBM_dec.txt"]
for s in scripts:
    with open(os.path.join(TEST_DIR, s), "r", encoding="UTF-8") as fp:
        tag = ""
        enc_opts = ""
        dec_opts = ""
        diff_opts  = ""
        for line in fp.readlines():
            if line.startswith("$ENC_BIN"):
                enc_opts = line
            if line.startswith("$DEC_BIN"):
                dec_opts = line
            if line.startswith("$DIFF_BIN"):
                diff_opts = line[9:]
                tag = s + "--" + diff_opts.split()[1].split('/')[-1]
                if tag in test_dict:
                    print("non-unique tag found - ignoring new entry")
                    continue                
                test_dict[tag] = (enc_opts, dec_opts, diff_opts)
                tag = ""
                enc_opts = ""
                dec_opts = ""
                diff_opts  = ""

@pytest.mark.parametrize("test_tag", list(test_dict.keys()))
def test_evs_26444(test_tag):

    enc_opts, dec_opts, diff_opts = test_dict[test_tag]

    if enc_opts:
        enc_opts = enc_opts.replace("./", TEST_DIR + "/")
        subprocess.run(["./IVAS_cod"] + enc_opts.split()[1:])
    if dec_opts:
        dec_opts = dec_opts.replace("./", TEST_DIR + "/")
        subprocess.run(["./IVAS_dec"] + dec_opts.split()[1:])    
        
    diff_opts = diff_opts.replace("./", TEST_DIR + "/")
    if ';' in diff_opts:
        cmd1, cmd2 = diff_opts.split(';')
        cmd1 = cmd1.split()
        cmd2 = cmd2.split()        
        result1 = filecmp.cmp(cmd1[0], cmd1[1])
        result2 = filecmp.cmp(cmd2[2], cmd2[3])
    else:
        cmd1 = diff_opts.split()
        result1 = filecmp.cmp(cmd1[0], cmd1[1])
        result2 = True
    if not (result1 and result2):
        assert False, "Output differs" 

          
        
 No newline at end of file