summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2021-09-10 00:39:25 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2021-09-10 00:39:25 +0900
commit51e3295659dd9178b98fb266da5abcb750805be8 (patch)
treeb59663eee6b09aa8c25f18c89011cf98bd2192b3
parent6b979e7897c8c4316d0345c1ede5bcbcb5b64cd8 (diff)
downloadibus-51e3295659dd9178b98fb266da5abcb750805be8.tar.gz
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.
-rw-r--r--src/tests/Makefile.am11
-rwxr-xr-xsrc/tests/ibus-desktop-testing-autostart55
-rwxr-xr-xsrc/tests/ibus-desktop-testing-runner.in20
-rw-r--r--src/tests/ibus-desktop-testing.desktop.in11
4 files changed, 93 insertions, 4 deletions
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;