Blob Blame History Raw
---
- hosts: localhost
  tags:
    - classic

  tasks:
    - name: Define remote_artifacts if it is not already defined
      set_fact:
        artifacts: ${HOME}/artifacts
      when: artifacts is not defined

    - name: Make artifacts directory
      file: path={{ artifacts }} state=directory recurse=yes

    - block:
      - name: Execute tests
        shell: |
          logfile={{ artifacts }}/test.{{ item }}.log
          exec 2>>$logfile 1>>$logfile
          cd tests
          #make script executable
          chmod 0775 {{ item }}
          #execute the test
          python2 {{ item }}.py
          if [ $? -eq 0 ]; then
              echo "PASS {{ item }}" >> {{ artifacts }}/test.log
          else
              echo "FAIL {{ item }}" >> {{ artifacts }}/test.log
          fi
        with_items:
        - "test_4GBsegfault"
        - "test_big_file_in_archive"
        - "test_long_path_in_archive"
        - "test_many_files_in_archive"
        - "test_umask"
        - "test_umask_when_creating"
        - "test_zipnote_fails_to_update_the_archive"

      # Can't go in block. See
      # https://github.com/ansible/ansible/issues/20736
      - name: Check the results
        shell: grep "^FAIL" {{ artifacts }}/test.log
        register: test_fails
        failed_when: test_fails.stdout or test_fails.stderr