From a337fe4f3973d415e42583fe146242db7b21dd68 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Sat, 11 May 2024 18:20:59 +0900 Subject: [PATCH] Implement latest IBus CI Generate results.yml to follow the defined result format https://docs.fedoraproject.org/en-US/ci/standard-test-interface/#_results_format --- .../files/check-results.sh | 66 +++++++++++++++ .../ibus-desktop-testing-role/tasks/main.yml | 83 ++++++++----------- tests/tests.yml | 2 + 3 files changed, 102 insertions(+), 49 deletions(-) create mode 100755 tests/roles/ibus-desktop-testing-role/files/check-results.sh diff --git a/tests/roles/ibus-desktop-testing-role/files/check-results.sh b/tests/roles/ibus-desktop-testing-role/files/check-results.sh new file mode 100755 index 0000000..1160dac --- /dev/null +++ b/tests/roles/ibus-desktop-testing-role/files/check-results.sh @@ -0,0 +1,66 @@ +#!/bin/bash + +TEST_LOG="test.log" +TEST_RUN_IN_RAWHIDE="1" + +if [ $# -gt 0 ] ; then + TEST_LOG="$1" + TEST_RUN_IN_RAWHIDE="$2" +fi + +gen_results() +{ + TEST_RUNTIME="$1" + TEST_STATUS="$2" + TEST_STATUS_UPPER="$(echo "$TEST_STATUS" | tr '[:lower:]' '[:upper:]')" + cat > results.xml << _EOF +results: + +- test: results + result: $TEST_STATUS + runtime: $TEST_RUNTIME + logs: + - ${TEST_STATUS_UPPER}-str_results.log + +_EOF + + DIR=$(dirname "$TEST_LOG") + if [ x"$TEST_LOG" != x ] ; then + cp "$TEST_LOG" "$DIR/${TEST_STATUS_UPPER}-str_results.log" + else + touch "$DIR/${TEST_STATUS_UPPER}-str_results.log" + fi + if [ x"$DIR" != x. ] ; then + mv results.xml "$DIR" + fi +} + +if [ $TEST_RUN_IN_RAWHIDE -eq 0 ] ; then + IS_RAWHIDE="$(grep -i rawhide /etc/fedora-release)" + if [ x"$IS_RAWHIDE" != x ] ; then + gen_results "0" "pass" + exit 0 + fi +fi +if [ ! -f $TEST_LOG ] ; then + gen_results "0" "fail" + echo ERROR +else + FAIL="$(grep "^FAIL: " $TEST_LOG | grep -v 'FAIL: 0$')" + RUNTIME_FAIL="$(grep -v 'frame' $TEST_LOG | grep "^FAIL: " | sed -e "s/FAIL: //")" + RUNTIME_PASS="$(grep -v 'frame' $TEST_LOG | grep "^PASS: " | sed -e "s/PASS: //")" + if [ x"$RUNTIME_FAIL" = x ] ; then + RUNTIME_FAIL="0" + fi + if [ x"$RUNTIME_PASS" = x ] ; then + RUNTIME_PASS="0" + fi + RUNTIME="$(expr $RUNTIME_FAIL + $RUNTIME_PASS)" + if [ x"$FAIL" != x ] ; then + gen_results "$RUNTIME" "fail" + echo ERROR + else + gen_results "$RUNTIME" "pass" + fi +fi + diff --git a/tests/roles/ibus-desktop-testing-role/tasks/main.yml b/tests/roles/ibus-desktop-testing-role/tasks/main.yml index 44c70e2..38733f3 100644 --- a/tests/roles/ibus-desktop-testing-role/tasks/main.yml +++ b/tests/roles/ibus-desktop-testing-role/tasks/main.yml @@ -11,57 +11,46 @@ - name: Installing build dependencies for IBus and GNOME installed-tests testing harness package: name: - - git - - make - - gcc - - diffutils - - autoconf - - automake - - libtool - - glib2-devel - - systemd-devel - - gnome-session - - gnome-shell - - dbus-x11 + # IBus CI sets - xorg-x11-server-Xvfb - ibus - ibus-desktop-testing - - ibus-anthy-tests - # ibus-compose test needs locales - - glibc-langpack-el - - glibc-langpack-fi - - glibc-langpack-pt - - - 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 + - dbus-x11 + - gnome-desktop-testing + # dnf group info GNOME + - gnome-session-wayland-session + - gnome-session-xsession + - gnome-settings-daemon + - gnome-shell + - polkit + - NetworkManager-ssh-gnome + - PackageKit-command-not-found + - PackageKit-gtk3-module + - adobe-source-code-pro-fonts + - at-spi2-atk + - at-spi2-core + - glib-networking + - gnome-backgrounds + - gnome-classic-session + - gnome-clocks + - gnome-color-manager + - gnome-contacts + - gnome-font-viewer + - gnome-logs + - gnome-maps - name: Start IBus installed-tests testing harness environment: ANSIBLE: 1 TMPDIR: '{{ remote_artifacts }}' G_MESSAGES_DEBUG: 'all' + LANG: 'C.UTF-8' block: - name: Execute IBus tests shell: | set -e + # Delete LC_CTYPE=C.UTF-8 + export -n LC_CTYPE status="FAIL: frame" if [ -f $HOME/.config/anthy/last-record2_default.utf8 ] ; then \ rm $HOME/.config/anthy/last-record2_default.utf8 @@ -80,6 +69,12 @@ if [ $? -eq 0 ]; then status="PASS: frame" fi + if [ -f /var/tmp/ibus-ci-autostart.log ] ; then + echo "#### /var/tmp/ibus-ci-autostart.log" + cat /var/tmp/ibus-ci-autostart.log + rm /var/tmp/ibus-ci-autostart.log + echo "#" + fi echo "${status}" >> {{ remote_artifacts }}/test.log echo "#### {{ remote_artifacts }}/{{ installed_test_name }}.log" if [ -f {{ remote_artifacts }}/{{ installed_test_name }}.log ] ; then @@ -93,17 +88,7 @@ echo "#" - name: Check the results - #shell: grep "^FAIL" {{ remote_artifacts }}/test.log - shell: | - log="{{ remote_artifacts }}/test.log" - if [ ! -f $log ] ; then - echo ERROR - else - FAIL=`grep "^FAIL: " {{ remote_artifacts }}/test.log | grep -v 'FAIL: 0$'` - if [ x"$FAIL" != x ] ; then - echo ERROR - fi - fi + script: check-results.sh "{{ remote_artifacts }}/test.log" "0" register: test_fails failed_when: False diff --git a/tests/tests.yml b/tests/tests.yml index b175564..94551ce 100644 --- a/tests/tests.yml +++ b/tests/tests.yml @@ -5,4 +5,6 @@ tags: - classic - gating + required_packages: + - ibus-anthy-tests