Loading scripts/ivas_pytests/self_test_b.py +1 −90 Original line number Diff line number Diff line Loading @@ -42,15 +42,9 @@ import os import sys import argparse import subprocess import shutil import platform from pathlib import Path TRUNK_SVN_PATH = "https://svnext02.iis.fraunhofer.de/ivas_dev/trunk" SVNUSER = os.getenv("SVNUSER") SVNPASSWD = os.getenv("SVNPASSWD") BIN_EXT = ".exe" if platform.system() == "Windows" else "" HERE = Path(__file__).parent.resolve() DEFAULT_ENCODER_DUT = str(HERE.joinpath(f"../../IVAS_cod{BIN_EXT}").resolve()) Loading @@ -63,48 +57,6 @@ REFERENCE_DIR = str(HERE.joinpath("ref").resolve()) DUT_BASE_DIR = str(HERE.joinpath("dut").resolve()) def get_svn_trunk_revision(): """ Get the SVN HEAD revision number of the trunk folder. """ command = ["svn"] if SVNUSER: command.extend(["--username", SVNUSER]) if SVNPASSWD: command.extend(["--password", SVNPASSWD]) command.extend(["info", TRUNK_SVN_PATH]) result = subprocess.run(command, capture_output=True, check=True) for line in result.stdout.decode("ascii").splitlines(): if line.startswith("Revision:"): return int(line.split()[1]) assert 0, "unable to determine SVN trunk revision" def get_svn_local_revision(): """ Get the SVN revision number of the local (trunk) folder. """ command = ["svn", "info", "."] result = subprocess.run(command, capture_output=True, check=True) for line in result.stdout.decode("ascii").splitlines(): if line.startswith("Revision:"): return int(line.split()[1]) return 0 # unable to determine local SVN revision def svn_export_trunk(revision, out_folder): """ Export the SVN trunk folder in a specific revision. """ command = ["svn"] if SVNUSER: command.extend(["--username", SVNUSER]) if SVNPASSWD: command.extend(["--password", SVNPASSWD]) command.extend(["export", "-q", "-r", str(revision), TRUNK_SVN_PATH, out_folder]) subprocess.run(command, check=True) def build_enc_and_dec(src_dir): """ Build the encoder and decoder binaries. Loading Loading @@ -145,40 +97,6 @@ def build_crend_unittest(src_dir): subprocess.run(command, check=True) def build_ref_binaries(ref_decoder_path, ref_encoder_path, ref_version): """ Build the REF binaries. """ print("Building the REF binaries") if ref_version is None: ref_version = get_svn_local_revision() if ref_version == 0: ref_version = get_svn_trunk_revision() if ref_version == 0: # special REF binaries generation: copy DUT binaries print("- copy DUT binaries -> REF binaries") dut_src_dir = str(HERE.joinpath("../..").resolve()) shutil.copy(f"{dut_src_dir}/IVAS_cod{BIN_EXT}", ref_encoder_path) shutil.copy(f"{dut_src_dir}/IVAS_dec{BIN_EXT}", ref_decoder_path) shutil.copy(f"{dut_src_dir}/scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test{BIN_EXT}", CREND_UNITTEST_REF) return # is a local directory with the reference version available? ref_src_dir = str(HERE.joinpath(f"../../../ref_src/{ref_version}").resolve()) if not os.path.exists(ref_src_dir): print(f"ref src dir {ref_src_dir} does not exist") svn_export_trunk(ref_version, ref_src_dir) build_enc_and_dec(ref_src_dir) print(f"copy: {ref_src_dir}/IVAS_cod{BIN_EXT} -> {ref_encoder_path}") shutil.copy(f"{ref_src_dir}/IVAS_cod{BIN_EXT}", ref_encoder_path) print(f"copy: {ref_src_dir}/IVAS_dec{BIN_EXT} -> {ref_decoder_path}") shutil.copy(f"{ref_src_dir}/IVAS_dec{BIN_EXT}", ref_decoder_path) build_crend_unittest(ref_src_dir) print(f"copy: {ref_src_dir}/scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test{BIN_EXT} -> {CREND_UNITTEST_REF}") shutil.copy(f"{ref_src_dir}/scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test{BIN_EXT}", CREND_UNITTEST_REF) def build_dut_binaries(): """ Build the DUT binaries. Loading @@ -195,13 +113,6 @@ def main(argv): sys.exit("This script is written for Python >= 3.7. Found: " + platform.python_version()) parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) parser.add_argument( "--rref", action="store", type=int, default=None, help="SVN revision for the reference (default: HEAD)", ) parser.add_argument( "--create_only", action="store_true", Loading Loading @@ -252,7 +163,7 @@ def main(argv): else: decref_path = DEFAULT_DECODER_REF if not os.path.exists(encref_path) or not os.path.exists(decref_path): build_ref_binaries(decref_path, encref_path, args.rref) sys.exit("Reference binaries do not exist.") # check for test vectors if not os.path.exists(TEST_VECTOR_DIR): Loading Loading
scripts/ivas_pytests/self_test_b.py +1 −90 Original line number Diff line number Diff line Loading @@ -42,15 +42,9 @@ import os import sys import argparse import subprocess import shutil import platform from pathlib import Path TRUNK_SVN_PATH = "https://svnext02.iis.fraunhofer.de/ivas_dev/trunk" SVNUSER = os.getenv("SVNUSER") SVNPASSWD = os.getenv("SVNPASSWD") BIN_EXT = ".exe" if platform.system() == "Windows" else "" HERE = Path(__file__).parent.resolve() DEFAULT_ENCODER_DUT = str(HERE.joinpath(f"../../IVAS_cod{BIN_EXT}").resolve()) Loading @@ -63,48 +57,6 @@ REFERENCE_DIR = str(HERE.joinpath("ref").resolve()) DUT_BASE_DIR = str(HERE.joinpath("dut").resolve()) def get_svn_trunk_revision(): """ Get the SVN HEAD revision number of the trunk folder. """ command = ["svn"] if SVNUSER: command.extend(["--username", SVNUSER]) if SVNPASSWD: command.extend(["--password", SVNPASSWD]) command.extend(["info", TRUNK_SVN_PATH]) result = subprocess.run(command, capture_output=True, check=True) for line in result.stdout.decode("ascii").splitlines(): if line.startswith("Revision:"): return int(line.split()[1]) assert 0, "unable to determine SVN trunk revision" def get_svn_local_revision(): """ Get the SVN revision number of the local (trunk) folder. """ command = ["svn", "info", "."] result = subprocess.run(command, capture_output=True, check=True) for line in result.stdout.decode("ascii").splitlines(): if line.startswith("Revision:"): return int(line.split()[1]) return 0 # unable to determine local SVN revision def svn_export_trunk(revision, out_folder): """ Export the SVN trunk folder in a specific revision. """ command = ["svn"] if SVNUSER: command.extend(["--username", SVNUSER]) if SVNPASSWD: command.extend(["--password", SVNPASSWD]) command.extend(["export", "-q", "-r", str(revision), TRUNK_SVN_PATH, out_folder]) subprocess.run(command, check=True) def build_enc_and_dec(src_dir): """ Build the encoder and decoder binaries. Loading Loading @@ -145,40 +97,6 @@ def build_crend_unittest(src_dir): subprocess.run(command, check=True) def build_ref_binaries(ref_decoder_path, ref_encoder_path, ref_version): """ Build the REF binaries. """ print("Building the REF binaries") if ref_version is None: ref_version = get_svn_local_revision() if ref_version == 0: ref_version = get_svn_trunk_revision() if ref_version == 0: # special REF binaries generation: copy DUT binaries print("- copy DUT binaries -> REF binaries") dut_src_dir = str(HERE.joinpath("../..").resolve()) shutil.copy(f"{dut_src_dir}/IVAS_cod{BIN_EXT}", ref_encoder_path) shutil.copy(f"{dut_src_dir}/IVAS_dec{BIN_EXT}", ref_decoder_path) shutil.copy(f"{dut_src_dir}/scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test{BIN_EXT}", CREND_UNITTEST_REF) return # is a local directory with the reference version available? ref_src_dir = str(HERE.joinpath(f"../../../ref_src/{ref_version}").resolve()) if not os.path.exists(ref_src_dir): print(f"ref src dir {ref_src_dir} does not exist") svn_export_trunk(ref_version, ref_src_dir) build_enc_and_dec(ref_src_dir) print(f"copy: {ref_src_dir}/IVAS_cod{BIN_EXT} -> {ref_encoder_path}") shutil.copy(f"{ref_src_dir}/IVAS_cod{BIN_EXT}", ref_encoder_path) print(f"copy: {ref_src_dir}/IVAS_dec{BIN_EXT} -> {ref_decoder_path}") shutil.copy(f"{ref_src_dir}/IVAS_dec{BIN_EXT}", ref_decoder_path) build_crend_unittest(ref_src_dir) print(f"copy: {ref_src_dir}/scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test{BIN_EXT} -> {CREND_UNITTEST_REF}") shutil.copy(f"{ref_src_dir}/scripts/ivas_pytests/tests/unit_tests/crend/IVAS_crend_unit_test{BIN_EXT}", CREND_UNITTEST_REF) def build_dut_binaries(): """ Build the DUT binaries. Loading @@ -195,13 +113,6 @@ def main(argv): sys.exit("This script is written for Python >= 3.7. Found: " + platform.python_version()) parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter) parser.add_argument( "--rref", action="store", type=int, default=None, help="SVN revision for the reference (default: HEAD)", ) parser.add_argument( "--create_only", action="store_true", Loading Loading @@ -252,7 +163,7 @@ def main(argv): else: decref_path = DEFAULT_DECODER_REF if not os.path.exists(encref_path) or not os.path.exists(decref_path): build_ref_binaries(decref_path, encref_path, args.rref) sys.exit("Reference binaries do not exist.") # check for test vectors if not os.path.exists(TEST_VECTOR_DIR): Loading