Commit 06a37541 authored by Jan Kiene's avatar Jan Kiene
Browse files

add script and test job for be-to-evs-mono test

parent 0c0f9370
Loading
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
variables:
  TESTV_DIR: "/usr/local/testv"
  EVS_BE_TEST_DIR: "/usr/local/evs_be_test"


# prevent running two pipelines on pushes to merge request branches
@@ -97,6 +98,31 @@ codec-smoke-test:
      - out/logs


# check bitexactness to EVS
be-2-evs:
  extends: .test-job-linux
  tags:
    - test-fhg-linux-runner1
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
  stage: test
  needs: [ "build-codec-linux-cmake" ]
  script:
    - mkdir build
    - cd build
    - cmake ..
    - make -j
    - cd ..

    # try with copy-over first
    - cp -r $EVS_BE_TEST_DIR ./evs_be_test
    - cp IVAS_cod ./evs_be_test/bin/EVS_cod
    - cp IVAS_dec ./evs_be_test/bin/EVS_dec

    - cd evs_be_test
    - python3 ci/run_evs_be_check.py


# compare bit exactness between target and source branch
self-test-on-merge-request:
  extends: .test-job-linux

ci/run_evs_be_test.py

0 → 100644
+70 −0
Original line number Diff line number Diff line
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 = ["switchPaths", "testv"]


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, [result_dict] * len(README_FILES_PARALLEL)
        )

    # JBM test after that
    run_file(README_FILES_JBM[0], result_dict)

    return analyze_results(result_dict)


def analyze_results(result_dict):
    ret = 0

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

    return ret


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


def environment_is_correct():
    ok = 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.")
            ok = False

    return ok


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