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

put more common parts of the pytest jobs into yaml anchors

parent 1c887395
Loading
Loading
Loading
Loading
Loading
+12 −16
Original line number Diff line number Diff line
@@ -78,9 +78,18 @@ stages:
  - mv IVAS_dec ../IVAS_dec_ref
  - cd ..

  # rename test binaries back
  - mv IVAS_cod_test IVAS_cod
  - mv IVAS_dec_test IVAS_dec

  ### re-checkout the commit from the source branch to have up-to-date self_test.py and scripts/testv (and actually everything)
  - git checkout $source_branch_commit_sha

.merge-request-comparison-check: &merge-request-comparison-check
    - if [ $zero_errors != 1 ]; then echo "Run errors encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "Non-bitexact cases without non-BE tag encountered!"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "Non-bitexact  cases with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi
    - exit 0

# ---------------------------------------------------------------
# Job templates
@@ -329,9 +338,6 @@ ivas-pytest-on-merge-request:
    ### prepare pytest
    # create short test vectors
    - python3 tests/create_short_testvectors.py
    # rename test binaries back
    - mv IVAS_cod_test IVAS_cod
    - mv IVAS_dec_test IVAS_dec
    # create references
    - python3 -m pytest tests -v --update_ref 1 -m create_ref
    - python3 -m pytest tests -v --update_ref 1 -m create_ref_part2
@@ -341,11 +347,7 @@ ivas-pytest-on-merge-request:
    - python3 -m pytest tests -v --junit-xml=report-junit.xml || exit_code=$?
    - zero_errors=$(cat report-junit.xml | grep -c 'errors="0"') || true

    - if [ $zero_errors != 1 ]; then echo "Run errors in pytest"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures without non-BE tag encountered"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $non_be_flag != 0 ]; then echo "pytest run had failures with non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi

    - exit 0
    - *merge-request-comparison-check

  allow_failure:
    exit_codes:
@@ -372,12 +374,9 @@ evs-pytest-on-merge-request:
    - *merge_request_comparison_setup

    # some helper variables - "|| true" to prevent failures from grep not finding anything
    - evs_non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[evs[ -]*non[ -]*be\]") || true
    - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[evs[ -]*non[ -]*be\]") || true

    ### prepare pytest
    # rename test binaries back
    - mv IVAS_cod_test IVAS_cod
    - mv IVAS_dec_test IVAS_dec
    # create references
    - python3 -m pytest tests/test_param_file.py -v --update_ref 1 -m create_ref --param_file scripts/config/self_test_evs.prm

@@ -386,10 +385,7 @@ evs-pytest-on-merge-request:
    - python3 -m pytest tests/test_param_file.py -v --param_file scripts/config/self_test_evs.prm --junit-xml=report-junit-evs.xml || exit_code=$?
    - zero_errors=$(cat report-junit-evs.xml | grep -c 'errors="0"') || true

    - if [ $zero_errors != 1 ]; then echo "Run errors in pytest for EVS"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $evs_non_be_flag == 0 ]; then echo "Non-bitexact EVS cases without EVS-non-BE tag encountered"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ] && [ $evs_non_be_flag != 0 ]; then echo "Non-bitexact EVS cases with EVS-non-BE tag encountered"; exit $EXIT_CODE_NON_BE; fi
    - exit 0
    - *merge-request-comparison-check

  allow_failure:
    exit_codes: