1d2a83b
---
1d2a83b
- name: Check if GNOME installed-tests testing harness is installed
1d2a83b
  register: gnome_desktop_testing_runner
1d2a83b
  find:
1d2a83b
      paths: "{{ ansible_env.PATH.split(':') }}"
1d2a83b
      pattern: gnome-desktop-testing-runner
1d2a83b
1d2a83b
- name: Build and install GNOME installed-tests testing harness
1d2a83b
  when: gnome_desktop_testing_runner.matched == 0
1d2a83b
  block:
1d2a83b
    - name: Installing build dependencies for IBus and GNOME installed-tests testing harness
1d2a83b
      package:
1d2a83b
          name:
1d2a83b
            - git
1d2a83b
            - make
1d2a83b
            - gcc
1d2a83b
            - diffutils
1d2a83b
            - autoconf
1d2a83b
            - automake
1d2a83b
            - libtool
1d2a83b
            - glib2-devel
1d2a83b
            - systemd-devel
1d2a83b
            - gnome-session
1d2a83b
            - gnome-shell
1d2a83b
            - dbus-x11
1d2a83b
            - xorg-x11-server-Xvfb
1d2a83b
            - ibus
1d2a83b
            - ibus-desktop-testing
1d2a83b
            - ibus-anthy-tests
1d2a83b
            # ibus-compose test needs locales
1d2a83b
            - glibc-langpack-el
1d2a83b
            - glibc-langpack-fi
1d2a83b
            - glibc-langpack-pt
1d2a83b
1d2a83b
    - name: Fetching GNOME installed-tests testing harness source from remote repository
1d2a83b
      git:
1d2a83b
          repo: 'https://gitlab.gnome.org/GNOME/gnome-desktop-testing.git'
1d2a83b
          dest: gnome-desktop-testing
1d2a83b
          force: yes
1d2a83b
1d2a83b
    - name: Configure GNOME installed-tests testing harness build
1d2a83b
      command: ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var
1d2a83b
      args:
1d2a83b
          chdir: gnome-desktop-testing
1d2a83b
1d2a83b
    - name: Build GNOME installed-tests testing harness
1d2a83b
      command: make
1d2a83b
      args:
1d2a83b
          chdir: gnome-desktop-testing
1d2a83b
1d2a83b
    - name: Install GNOME installed-tests testing harness
1d2a83b
      command: make install
1d2a83b
      args:
1d2a83b
          chdir: gnome-desktop-testing
1d2a83b
1d2a83b
    - name: Install tap.py
1d2a83b
      shell: |
1d2a83b
          TAP_DIR=`python -m site --user-site`/tap
1d2a83b
          if [ x"$TAP_DIR" != x -a ! -d "$TAP_DIR" ] ; then
1d2a83b
              echo "pip install tap.py --user"
1d2a83b
              pip install tap.py --user
1d2a83b
          fi
1d2a83b
1d2a83b
- name: Start IBus installed-tests testing harness
1d2a83b
  block:
1d2a83b
  - name: Execute IBus tests
1d2a83b
    shell: |
1d2a83b
      set -e
1d2a83b
      status="FAIL: frame"
1d2a83b
      if [ -f $HOME/.config/anthy/last-record2_default.utf8 ] ; then \
1d2a83b
          rm $HOME/.config/anthy/last-record2_default.utf8
1d2a83b
      fi
1d2a83b
      if [ -f $HOME/.anthy/last-record2_default.utf8 ] ; then \
1d2a83b
          rm $HOME/.anthy/last-record2_default.utf8
1d2a83b
      fi
1d2a83b
      env TMPDIR='{{ remote_artifacts }}' G_MESSAGES_DEBUG='all' \
1d2a83b
          ibus-desktop-testing-runner \
1d2a83b
          --no-graphics \
1d2a83b
          --runner=gnome \
1d2a83b
          --tests='{{ installed_test_name }}' \
1d2a83b
          --output='{{ remote_artifacts }}/{{ installed_test_name }}.log' \
1d2a83b
          --result='{{ remote_artifacts }}/test.log' \
1d2a83b
          null
1d2a83b
      if [ $? -eq 0 ]; then
1d2a83b
          status="PASS: frame"
1d2a83b
      fi
1d2a83b
      echo "${status} $TEST" >> {{ remote_artifacts }}/test.log
1d2a83b
1d2a83b
  - name: Check the results
1d2a83b
    #shell: grep "^FAIL" {{ remote_artifacts }}/test.log
1d2a83b
    shell: |
1d2a83b
        log="{{ remote_artifacts }}/test.log"
1d2a83b
        if [ ! -f $log ] ; then
1d2a83b
            echo ERROR
1d2a83b
        else
1d2a83b
            FAIL=`grep "^FAIL: " {{ remote_artifacts }}/test.log | grep -v 'FAIL: 0$'`
1d2a83b
            if [ x"$FAIL" != x ] ; then
1d2a83b
                echo ERROR
1d2a83b
            else
1d2a83b
                echo PASS
1d2a83b
            fi
1d2a83b
        fi
1d2a83b
    register: test_fails
1d2a83b
    #failed_when: False
1d2a83b
1d2a83b
  - name: Set role result
1d2a83b
    set_fact:
1d2a83b
      role_result: "{{ test_fails.stdout }}"
1d2a83b
      role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}"
1d2a83b
      role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}"
1d2a83b
1d2a83b
  - include_role:
1d2a83b
      name: str-common-final
1d2a83b