Commit fcf0936a authored by Jan Kiene's avatar Jan Kiene
Browse files

Merge branch 'add_evs_be_test_to_ci' into 'main'

Add test for bitexactness to EVS mono to CI

See merge request !44
parents 2fbd5586 5aeaca8b
Loading
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
variables:
  TESTV_DIR: "/usr/local/testv"
  BUILD_OUTPUT: "build_output.txt"
  EVS_BE_TEST_DIR: "/usr/local/be_2_evs_test"


# This sets when pipelines are created. Jobs have more specific rules to restrict them.
@@ -202,6 +203,30 @@ codec-smoke-test:
    expose_as: 'Smoke test results'


# check bitexactness to EVS
be-2-evs-linux:
  extends:
    - .test-job-linux
    - .rules-main-push
  tags:
    - be-2-evs-temp
  stage: test
  script:
    - mkdir build
    - cd build
    - cmake ..
    - make -j
    - cd ..

    # copy over to never change the testvector dir
    - cp -r $EVS_BE_TEST_DIR ./evs_be_test
    - cp build/IVAS_cod ./evs_be_test/bin/EVS_cod
    - cp build/IVAS_dec ./evs_be_test/bin/EVS_dec

    - cd evs_be_test
    - python3 ../ci/run_evs_be_test.py


# code selftest testvectors with memory-sanitizer binaries
msan-on-merge-request-linux:
  extends: 

ci/run_evs_be_test.py

0 → 100755
+76 −0
Original line number Diff line number Diff line
#!/usr/bin/env python3
import subprocess
import pathlib
import sys
import concurrent.futures
from threading import Lock


README_FILES_PARALLEL = [
    "Readme_AMRWB_IO_enc.txt",
    "Readme_AMRWB_IO_dec.txt",
    "Readme_EVS_enc.txt",
    "Readme_EVS_dec.txt",
]
README_FILES_JBM = ["Readme_JBM_dec.txt"]
README_FILES = README_FILES_PARALLEL + README_FILES_JBM
BINARY_PATHS = ["./bin/EVS_cod", "./bin/EVS_dec"]
FOLDER_PATHS = ["testv"]
BIN_PATHS = BINARY_PATHS * 2

def main():

    if not environment_is_correct():
        return 1

    result_dict = dict()
    # run first part in parallel
    with concurrent.futures.ThreadPoolExecutor(max_workers=4) as executor:
        executor.map(
            run_file, README_FILES_PARALLEL, BIN_PATHS, [result_dict] * len(README_FILES_PARALLEL)
        )

    # JBM test can not run concurrently with the others
    run_file(README_FILES_JBM[0], BINARY_PATHS[1], result_dict)

    return analyze_results(result_dict)


def analyze_results(result_dict):
    ret = 0

    for filename, ret_code in result_dict.items():
        if ret_code != 0:
            print(f"========= Test for {filename} failed! See log below: ==========")
            with open(filename.replace("Readme", "Log")) as f:
                print(f.read())
            ret = 1

    return ret


def run_file(filename: str, bin_path: str, result_dict: dict):
    ret_code = subprocess.call(["bash", filename, bin_path])
    with Lock():
        result_dict[filename] = ret_code


def environment_is_correct():
    """
    Check that the folder with the test resources is set up correctly:
    - all Readme files there
    - EVS binaries available in bin/
    - testv and switchPaths folder exist - Content is not checked, though
    """
    ret = True

    for path in README_FILES + BINARY_PATHS + FOLDER_PATHS:
        if not pathlib.Path(path).exists():
            print(f"Environment setup is incorrect - {path} not found.")
            ret = False

    return ret


if __name__ == "__main__":
    sys.exit(main())