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

fix problems with the helper variables and always run full test

parent 1daf9bd3
Loading
Loading
Loading
Loading
Loading
+17 −13
Original line number Diff line number Diff line
@@ -145,26 +145,30 @@ self-test-on-merge-request:

    ### analyse test output

    # some helper variables
    - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[non[ -]*be\]")
    - run_errors=$(cat test_output.txt | grep -c "Run errors were encountered for the following conditions:")
    - bitexact=$(cat test_output.txt | grep -c "All [0-9]* tests are bitexact")
    - exit_code_non_be=123
    - exit_code_fail=1
    # some helper variables - "|| true" to prevent failures from grep not finding anything
    - non_be_flag=$(echo $CI_MERGE_REQUEST_TITLE | grep -c --ignore-case "\[non[ -]*be\]") || true
    - run_errors=$(cat test_output.txt | grep -c "test conditions had run errors") || true
    - bitexact=$(cat test_output.txt | grep -c "All [0-9]* tests are bitexact") || true
    - EXIT_CODE_NON_BE=123
    - EXIT_CODE_FAIL=1

    - selftest_exit_code=0

    # check for crashes during the test, if any happened, fail the test
    - if $run_errors ; then echo "Run errors in self_test.py"; exit $exit_code_fail; fi
    - if [ $run_errors != 0 ] ; then echo "Run errors in self_test.py"; exit $EXIT_CODE_FAIL; fi

    # check for non bitexact output and fail test if the merge request does not have a non-BE tag
    - if ! $bitexact && ! $non_be_flag ; then echo "Non-bitexact cases without non-BE tag encountered"; exit $exit_code_fail; fi
    - if ! $bitexact ; then echo "Non-bitexact cases with non-BE tag encountered"; exit $exit_code_non_be; fi
    # check for non bitexact output and store exit code to also always run the SBA pytest
    - if [ $bitexact == 0 ] && [ $non_be_flag == 0 ] ; then echo "Non-bitexact cases without non-BE tag encountered"; selftest_exit_code=$EXIT_CODE_FAIL; fi
    - if [ $bitexact == 0 ] ; then echo "Non-bitexact cases with non-BE tag encountered"; selftest_exit_code=$EXIT_CODE_NON_BE; fi

    ### run SBA pytest
    - exit_code=0
    - python3 ./scripts/ivas_pytests/self_test_b.py --encref IVAS_cod_ref --decref IVAS_dec_ref --encdut IVAS_cod_test --decdut IVAS_dec_test || exit_code=$?
    - if [ $exit_code -eq 1 ] && ! $non_be_flag; then echo "pytest run had failures and non-BE flag not present"; exit $exit_code_fail; fi
    - if [ $exit_code -eq 1 ]; then echo "pytest run had failures and non-BE flag present"; exit $exit_code_non_be; fi
    - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $exit_code_fail; fi;
    - if [ $exit_code -eq 1 ] && [ $non_be_flag == 0 ]; then echo "pytest run had failures and non-BE flag not present"; exit $EXIT_CODE_FAIL; fi
    - if [ $exit_code -eq 1 ]; then echo "pytest run had failures and non-BE flag present"; exit $EXIT_CODE_NON_BE; fi
    - if [ $exit_code -ne 0 ]; then echo "pytest run had errors"; exit $EXIT_CODE_FAIL; fi;
    # return exit code from selftest if everything went well with the pytest run
    - exit $selftest_exit_code
  allow_failure:
    exit_codes:
      - 123