Add --screendump option in ibus-desktop-testing-runner

- Add ibus-desktop-testing-autostart
- Depend on gnome-desktop-testing instead of pulling from Git
- Move engine specific dependencies to tests.yml
This commit is contained in:
Takao Fujiwara 2021-08-28 01:00:50 +09:00
parent 9aa0978c6a
commit 611fd049eb
4 changed files with 291 additions and 40 deletions

View File

@ -54,3 +54,218 @@ index da9a402f..e66125df 100644
--
2.28.0
From 179ebddf4dbde1cef1cea2df4e659cf4940d1a30 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Fri, 27 Aug 2021 20:05:02 +0900
Subject: [PATCH] src/tests: Add --screendump option in
ibus-desktop-testing-runner
The screendump is useful in CI to if check gnome-shell-extension-no-overview
works.
Also add ibus-desktop-testing-autostart to get the debug info in CI.
You can copy ibus-desktop-testing.desktop to $HOME/.config/autostart
if CI fails.
---
src/tests/Makefile.am | 11 +++++
src/tests/ibus-desktop-testing-autostart | 55 +++++++++++++++++++++++
src/tests/ibus-desktop-testing-runner.in | 20 +++++++--
src/tests/ibus-desktop-testing.desktop.in | 11 +++++
4 files changed, 93 insertions(+), 4 deletions(-)
create mode 100755 src/tests/ibus-desktop-testing-autostart
create mode 100644 src/tests/ibus-desktop-testing.desktop.in
diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am
index 13c06eb4..7d00f236 100644
--- a/src/tests/Makefile.am
+++ b/src/tests/Makefile.am
@@ -96,6 +96,7 @@ test_sourcesdir = $(datadir)/installed-tests/ibus
CLEANFILES += \
$(test_metas) \
ibus-desktop-testing-runner \
+ org.freedesktop.IBus.Desktop.Testing.desktop \
$(NULL)
test_execs_PROGRAMS = $(TESTS)
@@ -106,6 +107,14 @@ CLEANFILES += \
$(NULL)
endif
test_execsdir = $(libexecdir)/installed-tests/ibus
+libexec_SCRIPTS = ibus-desktop-testing-autostart
+
+test_frame_DATA = org.freedesktop.IBus.Desktop.Testing.desktop
+test_framedir = $(pkgdatadir)/tests
+org.freedesktop.IBus.Desktop.Testing.desktop: ibus-desktop-testing.desktop.in
+ $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|g" \
+ $< > $@.tmp && \
+ mv $@.tmp $@
endif
$(test_metas): $(test_metas_in) $(test_programs)
@@ -133,6 +142,8 @@ EXTRA_DIST = \
ibus-compose.emoji \
ibus-compose.env \
ibus-compose-locales.in \
+ ibus-desktop-testing.desktop.in \
+ ibus-desktop-testing-autostart \
ibus-desktop-testing-runner.in \
$(NULL)
diff --git a/src/tests/ibus-desktop-testing-autostart b/src/tests/ibus-desktop-testing-autostart
new file mode 100755
index 00000000..da22b64e
--- /dev/null
+++ b/src/tests/ibus-desktop-testing-autostart
@@ -0,0 +1,55 @@
+#!/bin/sh
+# -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*-
+# vim:set noet ts=4:
+#
+# ibus - The Input Bus
+#
+# Copyright (c) 2021 Takao Fujiwara <takao.fujiwara1@gmail.com>
+# Copyright (c) 2021 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+TEST_LOG=
+COMMANDS='
+id
+echo $DISPLAY
+pwd
+pstree -asp $$
+gsettings list-recursively org.gnome.shell
+rpm -q gnome-shell-extension-no-overview gnome-shell gnome-session
+'
+
+if [ $# -gt 0 ] ; then
+ TEST_LOG=$1
+fi
+
+run_test()
+{
+while read cmd ; do
+ if [ x"$cmd" = x ] ; then
+ continue
+ fi
+ echo "# $cmd"
+ eval "$cmd"
+done << EOF_COMMANDS
+`echo "$COMMANDS"`
+EOF_COMMANDS
+}
+
+if [ x"$TEST_LOG" = x ] ; then
+ run_test
+else
+ run_test 2>>$TEST_LOG 1>>$TEST_LOG
+fi
diff --git a/src/tests/ibus-desktop-testing-runner.in b/src/tests/ibus-desktop-testing-runner.in
index c1016703..48528326 100755
--- a/src/tests/ibus-desktop-testing-runner.in
+++ b/src/tests/ibus-desktop-testing-runner.in
@@ -36,13 +36,14 @@
PROGNAME=`basename $0`
-VERSION=0.2
+VERSION=0.3
DISPLAY=:99.0
BUILDDIR="."
SRCDIR="."
TEST_LOG="test-suite.log"
TEST_LOG_STDOUT=0
RESULT_LOG=""
+SCREEN_LOG=""
HAVE_GRAPHICS=1
DESKTOP_COMMAND="dbus-launch --exit-with-session gnome-session"
PID_XORG=0
@@ -90,14 +91,15 @@ usage()
"-T, --timeout=TIMEOUT Set timeout (default TIMEOUT is 300 sec).\n" \
"-o, --output=OUTPUT_FILE OUtput the log to OUTPUT_FILE\n" \
"-O, --result=RESULT_FILE OUtput the result to RESULT_FILE\n" \
+"-S, --screendump=DUMP_FILE OUtput the screen to DUMP_FILE ('STDOUT' can be stdout)\n" \
""
}
parse_args()
{
# This is GNU getopt. "sudo port getopt" in BSD?
- ARGS=`getopt -o hvb:s:cd:t:r:T:o:O: --long \
- help,version,builddir:,srcdir:,no-graphics,desktop:,tests:,runner:,timeout:,output:,result:\
+ ARGS=`getopt -o hvb:s:cd:t:r:T:o:O:S: --long \
+ help,version,builddir:,srcdir:,no-graphics,desktop:,tests:,runner:,timeout:,output:,result:,screendump:\
-- "$@"`;
eval set -- "$ARGS"
while [ 1 ] ; do
@@ -113,6 +115,7 @@ parse_args()
-T | --timeout ) TIMEOUT="$2"; shift 2;;
-o | --output ) TEST_LOG="$2"; shift 2;;
-O | --result ) RESULT_LOG="$2"; shift 2;;
+ -S | --screendump ) SCREEN_LOG="$2"; shift 2;;
-- ) shift; break;;
* ) usage; exit 1;;
esac
@@ -259,6 +262,7 @@ run_desktop()
{
echo "$DESKTOP_COMMAND" | grep gnome-session > /dev/null
HAS_GNOME=$?
+ export DISPLAY=$DISPLAY
if test $HAVE_GRAPHICS -eq 1 ; then
/usr/libexec/Xorg.wrap -noreset +extension GLX +extension RANDR +extension RENDER -logfile ./xorg.log -config ./xorg.conf -configdir . $DISPLAY &
else
@@ -266,7 +270,6 @@ run_desktop()
fi
PID_XORG=$!
sleep 1
- export DISPLAY=$DISPLAY
# init_gnome need to be called with $DISPLAY before gnome-session is called
if [ $HAS_GNOME -eq 0 ] ; then
init_gnome
@@ -454,6 +457,15 @@ main()
init_desktop
run_dbus_daemon 2>>$TEST_LOG 1>>$TEST_LOG
run_desktop 2>>$TEST_LOG 1>>$TEST_LOG
+ if [ x"$SCREEN_LOG" != x ] ; then
+ SCREEN_PNG="`date '+%Y%m%d%H%M%S'`.png"
+ gnome-screenshot --file=$SCREEN_PNG
+ if [ x"$SCREEN_LOG" = xSTDOUT ] ; then
+ base64 $SCREEN_PNG
+ else
+ base64 $SCREEN_PNG > $SCREEN_LOG
+ fi
+ fi
run_test_suite
finit
}
diff --git a/src/tests/ibus-desktop-testing.desktop.in b/src/tests/ibus-desktop-testing.desktop.in
new file mode 100644
index 00000000..fa0c9b40
--- /dev/null
+++ b/src/tests/ibus-desktop-testing.desktop.in
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=IBus Desktop Testing Runner
+GenericName=Input Method Desktop Testing Runner
+Comment=Test plugin for IBus Desktop Testing
+Exec=@ibexecdir@/ibus-desktop-testing-autostart /var/tmp/ibus-ci-autostart.log
+Terminal=false
+Type=Application
+Encoding=UTF-8
+Icon=ibus
+Categories=System
+Keywords=im;
--
2.28.0

View File

@ -38,7 +38,7 @@
Name: ibus
Version: 1.5.25
Release: 1%{?dist}
Release: 2%{?dist}
Summary: Intelligent Input Bus for Linux OS
License: LGPLv2+
URL: https://github.com/ibus/%name/wiki
@ -414,7 +414,7 @@ dconf update || :
%{_datadir}/glib-2.0/schemas/*.xml
%{_datadir}/ibus/component
%{_datadir}/ibus/dicts
%{_datadir}/ibus/engine
%dir %{_datadir}/ibus/engine
%{_datadir}/ibus/keymaps
%{_datadir}/icons/hicolor/*/apps/*
%{_datadir}/man/man1/ibus.1.gz
@ -502,6 +502,8 @@ dconf update || :
%files desktop-testing
%{_bindir}/ibus-desktop-testing-runner
%{_datadir}/ibus/tests
%{_libexecdir}/ibus-desktop-testing-autostart
%files tests
%dir %{_libexecdir}/installed-tests
@ -510,6 +512,9 @@ dconf update || :
%{_datadir}/installed-tests/ibus
%changelog
* Fri Aug 27 2021 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.25-2
- Add --screendump option in ibus-desktop-testing-runner
* Fri Aug 20 2021 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.25-1
- Bump to 1.5.25

View File

@ -11,47 +11,66 @@
- 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-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
- gnome-photos
- gnome-remote-desktop
- gnome-screenshot
- gnome-system-monitor
- gnome-terminal-nautilus
- gnome-themes-extra
- gnome-user-docs
- gnome-user-share
- gnome-weather
- gvfs-afc
- gvfs-afp
- gvfs-archive
- gvfs-fuse
- gvfs-goa
- gvfs-gphoto2
- gvfs-mtp
- gvfs-smb
- libcanberra-gtk3
- libcanberra-gtk3
- libproxy-webkitgtk4
- librsvg2
- libsane-hpaio
- mesa-dri-drivers
- mesa-libEGL
- orca
- rygel
- sane-backends-drivers-scanners
- simple-scan
- tracker
- tracker-miners
- xdg-desktop-portal
- xdg-desktop-portal-gtk
- xdg-user-dirs-gtk
- name: Start IBus installed-tests testing harness
environment:
@ -76,6 +95,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

View File

@ -5,4 +5,10 @@
tags:
- classic
- gating
required_packages:
- ibus-tests
# ibus-compose test needs locales
- glibc-langpack-el
- glibc-langpack-fi
- glibc-langpack-pt