Blob Blame Raw
---

- block:
  - name: language coverage
    environment:
      LANG: "en_US.UTF-8"
    script: run-lang-coverage-test --lang "{{ item }}" {% if coverage.values is not defined or coverage[item].path_prefix is not defined %} --path {{ path_prefix }} {% else %} {{ '--path "' + (coverage[item].path_prefix | join('" --path "')) + '"' }} {% endif %} --artifactsdir "{{ remote_artifacts }}" {{ "" if coverage.values is not defined or coverage[item].name is not defined else "--name " + coverage[item].name }} {{ "" if coverage.values is not defined or coverage[item].exclude is not defined else '--exclude "' + (coverage[item].exclude | join('" --exclude "')) + '"'}} {{ "" if coverage.values is not defined or coverage[item].include is not defined else '--include "' + (coverage[item].include | join('" --include "')) + '"'}}
    with_items:
    - "{{ coverage if coverage.keys is not defined else coverage.keys()|list }}"
  - name: generic family assignment
    environment:
      LANG: "en_US.UTF-8"
    when: families is defined
    script: run-family-test --lang {{ item.lang }} --family '{{ item.family }}' --alias {{ item.alias }} --artifactsdir {{ remote_artifacts }} --package {{ package if item.package is not defined else item.package }}
    with_items:
    - "{{ families }}"

  - name: Collect all of failures into one file
    shell: |
      grep -v PASS "{{ remote_artifacts }}"/FAIL_*.log > "{{ remote_artifacts }}"/FAIL-all.log || :

  - name: Check the results
    shell: |
      log="{{ remote_artifacts }}/test.log"
      if [ ! -f "$log" ]; then
          echo ERROR
          echo "Test results not found." 1>&2
      elif grep ^ERROR "$log" 1>&2; then
          echo ERROR
      elif grep ^FAIL "$log" 1>&2; then
          echo FAIL
      elif grep -q ^PASS "$log"; then
          echo PASS
      else
          echo ERROR
          echo "No test results found." 1>&2
      fi
    register: test_results

  - name: Set role result
    set_fact:
      role_result: "{{ test_results.stdout }}"
      role_message: "{{ test_results.stderr|d('test execution error.') }}"
      role_result_failed: "{{ test_results.stdout != 'PASS' }}"
      role_result_msg: "{{ test_results.stderr|d('test execution error.') }}"

  - include_role:
      name: str-common-final

  - name: Validate the result
    shell: echo "test_results.stdout"
    failed_when: test_results.stdout != 'PASS'