From e61afc56d6c7cbdf28adb7850b77c3e4ab64cfe1 Mon Sep 17 00:00:00 2001 From: Adam Samalik Date: Wed, 21 Jun 2023 14:53:42 +0200 Subject: [PATCH] import sources --- .gitignore | 3 +- .../gnome-desktop-testing-role/README.md | 34 +++++++ .../defaults/main.yml | 6 ++ .../gnome-desktop-testing-role/meta/main.yml | 4 + .../gnome-desktop-testing-role/tasks/main.yml | 93 +++++++++++++++++++ tests/tests.yml | 8 ++ 6 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 tests/roles/gnome-desktop-testing-role/README.md create mode 100644 tests/roles/gnome-desktop-testing-role/defaults/main.yml create mode 100644 tests/roles/gnome-desktop-testing-role/meta/main.yml create mode 100644 tests/roles/gnome-desktop-testing-role/tasks/main.yml create mode 100644 tests/tests.yml diff --git a/.gitignore b/.gitignore index 2ba3e30..2818469 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1 @@ -SOURCES/clutter-1.26.2.tar.xz -/clutter-1.26.2.tar.xz +/clutter-1.*.tar.xz diff --git a/tests/roles/gnome-desktop-testing-role/README.md b/tests/roles/gnome-desktop-testing-role/README.md new file mode 100644 index 0000000..6e843ba --- /dev/null +++ b/tests/roles/gnome-desktop-testing-role/README.md @@ -0,0 +1,34 @@ +gnome-desktop-testing-role +========================== + +This ansible role is to make it easy to leverage gnome installed tests (via the gnome-desktop-testing module) + +Requirements +------------ +Xvfb + +If gnome-desktop-testing isn't installed it will be built from version control. + +Role Variables +-------------- +The variable installed_test_name is used to describe the name of the installed tests to run. +(the basename of the directory in /usr/share/installed-tests) + +Dependencies +------------ +standard-test-roles + +Example Playbook +---------------- +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: localhost + roles: + - role: gnome-desktop-testing-role + test_name: mutter + tags: + - classic + +License +------- +BSD diff --git a/tests/roles/gnome-desktop-testing-role/defaults/main.yml b/tests/roles/gnome-desktop-testing-role/defaults/main.yml new file mode 100644 index 0000000..c180eca --- /dev/null +++ b/tests/roles/gnome-desktop-testing-role/defaults/main.yml @@ -0,0 +1,6 @@ +role_pkgs_req: + - rsync + - xorg-x11-server-Xvfb + - dbus-daemon + - sudo + - tmux diff --git a/tests/roles/gnome-desktop-testing-role/meta/main.yml b/tests/roles/gnome-desktop-testing-role/meta/main.yml new file mode 100644 index 0000000..6626402 --- /dev/null +++ b/tests/roles/gnome-desktop-testing-role/meta/main.yml @@ -0,0 +1,4 @@ +--- + +dependencies: + - role: str-common-init diff --git a/tests/roles/gnome-desktop-testing-role/tasks/main.yml b/tests/roles/gnome-desktop-testing-role/tasks/main.yml new file mode 100644 index 0000000..7d555fa --- /dev/null +++ b/tests/roles/gnome-desktop-testing-role/tasks/main.yml @@ -0,0 +1,93 @@ +--- +- name: Check if GNOME installed-tests testing harness is installed + register: gnome_desktop_testing_runner + find: + paths: "{{ ansible_env.PATH.split(':') }}" + pattern: gnome-desktop-testing-runner + +- name: Build and install GNOME installed-tests testing harness + when: gnome_desktop_testing_runner.matched == 0 + block: + - name: Installing build dependencies for GNOME installed-tests testing harness + package: + name: + - git + - make + - gcc + - diffutils + - autoconf + - automake + - libtool + - glib2-devel + - systemd-devel + + - name: Fetching GNOME installed-tests testing harness source from remote repository + git: + repo: 'https://gitlab.gnome.org/GNOME/gnome-desktop-testing.git' + dest: gnome-desktop-testing + force: yes + + - name: Configure GNOME installed-tests testing harness build + command: ./autogen.sh --prefix=/usr --sysconfdir=/etc --localstatedir=/var + args: + chdir: gnome-desktop-testing + + - name: Build GNOME installed-tests testing harness + command: make + args: + chdir: gnome-desktop-testing + + - name: Install GNOME installed-tests testing harness + command: make install + args: + chdir: gnome-desktop-testing + +- name: Create a user to run GNOME installed-tests as + user: + name: shadowman + state: present + +- name: Start GNOME installed-tests testing harness + block: + - name: Allow shadowman user access to artifacts dir + file: + path: "{{ remote_artifacts }}" + mode: 01777 + + - name: Determine log file name + set_fact: + log_file: "{{ remote_artifacts }}/{{ installed_test_name }}.log" + + - name: Delete any stale log file + file: + path: "{{ log_file }}" + state: absent + + - name: Execute tests + become: yes + become_user: shadowman + shell: | + set -e + log_file="{{ log_file }}" + exec 2>>$log_file 1>>$log_file + status="FAIL" + xvfb-run -d -s '-screen 0 1024x768x24' dbus-run-session env TMPDIR='{{ remote_artifacts }}' G_MESSAGES_DEBUG='all' LANG=en_US.utf8 gnome-desktop-testing-runner '{{ installed_test_name }}' + if [ $? -eq 0 ]; then + status="PASS" + fi + echo "${status} $TEST" >> {{ remote_artifacts }}/test.log + args: + chdir: "{{ remote_artifacts }}" + + - name: Check the results + shell: grep "^FAIL" {{ remote_artifacts }}/test.log + register: test_fails + failed_when: False + + - name: Set role result + set_fact: + role_result_failed: "{{ (test_fails.stdout|d|length > 0) or (test_fails.stderr|d|length > 0) }}" + role_result_msg: "{{ test_fails.stdout|d('tests failed.') }}" + + - include_role: + name: str-common-final diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..2f6c9da --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,8 @@ +- hosts: localhost + roles: + - role: gnome-desktop-testing-role + installed_test_name: clutter + tags: + - classic + - gating +