From 877fe846051037e1b1a917d4e3e652ed1041cb08 Mon Sep 17 00:00:00 2001 From: Takao Fujiwara Date: Fri, 11 Apr 2025 15:14:17 +0900 Subject: [PATCH] Resolves: RHEL-1616 Add screenshot option in CI --- ibus-xx-tests-screenshot.patch | 112 ++++++++++++++++++ ibus.spec | 3 + .../ibus-desktop-testing-role/tasks/main.yml | 4 + 3 files changed, 119 insertions(+) create mode 100644 ibus-xx-tests-screenshot.patch diff --git a/ibus-xx-tests-screenshot.patch b/ibus-xx-tests-screenshot.patch new file mode 100644 index 0000000..b8372ba --- /dev/null +++ b/ibus-xx-tests-screenshot.patch @@ -0,0 +1,112 @@ +--- ibus-1.5.19/src/tests/ibus-desktop-testing-runner.in.orig 2025-04-11 13:28:17.764620101 +0900 ++++ ibus-1.5.19/src/tests/ibus-desktop-testing-runner.in 2025-04-11 15:02:27.189118306 +0900 +@@ -43,6 +43,7 @@ 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 +@@ -94,8 +95,9 @@ usage() + 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 +@@ -111,6 +113,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 +@@ -374,7 +377,12 @@ finit() + { + echo "# Killing left gnome-session and Xorg" + kill $PID_GNOME_SESSION $PID_XORG +- ibus exit ++ PID_IBUS=`pidof ibus-daemon` ++ if x$PID_IBUS != x ; then ++ ibus exit ++ else ++ echo "# Dead ibus-daemon" ++ fi + SUSER=`echo "$USER" | cut -c 1-7` + LEFT_CALENDAR=`ps -ef | grep gnome-shell-calendar-server | grep $SUSER | grep -v grep` + if [ x"$LEFT_CALENDAR" != x ] ; then +@@ -386,14 +394,67 @@ finit() + echo "# Finished $PROGNAME testing" + } + ++ ++save_screen_real() ++{ ++ SCREEN_PNG="`date '+%Y%m%d%H%M%S'`.png" ++ gnome-screenshot --file=$SCREEN_PNG ++ if test x"$SCREEN_LOG" = xSTDOUT ; then ++ base64 $SCREEN_PNG ++ touch /var/tmp/STDOUT.log ++ else ++ base64 $SCREEN_PNG > $SCREEN_LOG ++ fi ++} ++ ++ ++save_screen() ++{ ++ if test x"$SCREEN_LOG" = x ; then ++ return ++ fi ++ if test x"$SCREEN_LOG" = xSTDOUT ; then ++ if test -f /var/tmp/STDOUT.log ; then ++ rm /var/tmp/STDOUT.log ++ fi ++ else ++ if test -f "$SCREEN_LOG" ; then ++ rm "$SCREEN_LOG" ++ fi ++ fi ++ save_screen_real & ++ while test 1 ; do ++ if test x"$SCREEN_LOG" = xSTDOUT ; then ++ if test -f /var/tmp/STDOUT.log ; then ++ break ++ fi ++ else ++ if test -f "$SCREEN_LOG" ; then ++ break ++ fi ++ fi ++ sleep 1 ++ done ++} ++ ++ + main() + { ++ echo "TEST TIME `date`" + parse_args "$@" ++ echo "TEST2 TIME `date`" + init_desktop ++ echo "TEST3 TIME `date`" + run_dbus_daemon 2>>$TEST_LOG 1>>$TEST_LOG ++ echo "TEST4 TIME `date`" + run_desktop 2>>$TEST_LOG 1>>$TEST_LOG ++ echo "TEST5 TIME `date`" ++ save_screen ++ echo "TEST6 TIME `date`" + run_test_suite ++ echo "TEST7 TIME `date`" + finit ++ echo "TEST8 TIME `date`" + } + + # Need to enclose $@ with double quotes not to split the array. diff --git a/ibus.spec b/ibus.spec index 78a33c5..8eff06a 100644 --- a/ibus.spec +++ b/ibus.spec @@ -59,6 +59,8 @@ Patch6: %{name}-1682157-ci.patch Patch7: %{name}-1713606-hangul-with-mouse.patch # RHEL 8.5 Bug 1897548 - Enable to lookup Unicode names Patch8: %{name}-1897548-emoji-unicode.patch +# RHEL 8.10 screenshot in CI +Patch9: %{name}-xx-tests-screenshot.patch # RHEL 8.0 Under testing #1349148 #1385349 #1350291 #1406699 #1432252 #1601577 Patch100: %{name}-1385349-segv-bus-proxy.patch @@ -503,6 +505,7 @@ dconf update || : %changelog * Mon Apr 07 2025 Takao Fujiwara - 1.5.19-15 - Resolves: RHEL-1616 Replace gitlab.gnome.org with gitlab.com/redhat +- Add screenshot option in CI * Thu Sep 30 2021 Takao Fujiwara - 1.5.19-14 - Resolves: #2008074 - Fix regression of Emoji typing in Wayland diff --git a/tests/roles/ibus-desktop-testing-role/tasks/main.yml b/tests/roles/ibus-desktop-testing-role/tasks/main.yml index 6f431a2..a7cfaaa 100644 --- a/tests/roles/ibus-desktop-testing-role/tasks/main.yml +++ b/tests/roles/ibus-desktop-testing-role/tasks/main.yml @@ -20,9 +20,11 @@ - libtool - glib2-devel - systemd-devel + - gnome-screenshot - gnome-session - gnome-shell - dbus-x11 + - procps-ng - xorg-x11-server-Xvfb - ibus - ibus-desktop-testing @@ -78,6 +80,8 @@ --tests='{{ installed_test_name }}' \ --output='{{ remote_artifacts }}/{{ installed_test_name }}.log' \ --result='{{ remote_artifacts }}/test.log' \ + --screendump='STDOUT' \ + --timeout=900 \ null if [ $? -eq 0 ]; then status="PASS: frame"