aa3f4dc
---
aa3f4dc
- hosts: localhost
aa3f4dc
  tags:
aa3f4dc
    - classic
aa3f4dc
aa3f4dc
  tasks:
aa3f4dc
    - name: Define remote_artifacts if it is not already defined
aa3f4dc
      set_fact:
esakaiev@redhat.com 5bfd267
        artifacts: ${HOME}/artifacts
esakaiev@redhat.com 5bfd267
      when: artifacts is not defined
aa3f4dc
aa3f4dc
    - name: Make artifacts directory
esakaiev@redhat.com 5bfd267
      file: path={{ artifacts }} state=directory recurse=yes
aa3f4dc
aa3f4dc
    - block:
aa3f4dc
      - name: Execute tests
aa3f4dc
        shell: |
esakaiev@redhat.com 5bfd267
          logfile={{ artifacts }}/test.{{ item }}.log
aa3f4dc
          exec 2>>$logfile 1>>$logfile
aa3f4dc
          cd tests
aa3f4dc
          #make script executable
aa3f4dc
          chmod 0775 {{ item }}
aa3f4dc
          #execute the test
aa3f4dc
          python2 {{ item }}.py
aa3f4dc
          if [ $? -eq 0 ]; then
esakaiev@redhat.com 5bfd267
              echo "PASS {{ item }}" >> {{ artifacts }}/test.log
aa3f4dc
          else
esakaiev@redhat.com 5bfd267
              echo "FAIL {{ item }}" >> {{ artifacts }}/test.log
aa3f4dc
          fi
aa3f4dc
        with_items:
aa3f4dc
        - "test_4GBsegfault"
aa3f4dc
        - "test_big_file_in_archive"
aa3f4dc
        - "test_long_path_in_archive"
aa3f4dc
        - "test_many_files_in_archive"
aa3f4dc
        - "test_umask"
aa3f4dc
        - "test_umask_when_creating"
aa3f4dc
        - "test_zipnote_fails_to_update_the_archive"
aa3f4dc
aa3f4dc
      # Can't go in block. See
aa3f4dc
      # https://github.com/ansible/ansible/issues/20736
aa3f4dc
      - name: Check the results
esakaiev@redhat.com 5bfd267
        shell: grep "^FAIL" {{ artifacts }}/test.log
aa3f4dc
        register: test_fails
aa3f4dc
        failed_when: test_fails.stdout or test_fails.stderr
aa3f4dc
aa3f4dc
aa3f4dc