From 276e8071bf4f95f5d224f25aabc628fe5faaa5e3 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Thu, 5 Dec 2024 11:53:44 +0800 Subject: [PATCH] Update CI tests --- ibus-hangul.spec | 6 +++++- tests/main.fmf | 4 ++-- tests/runtest.sh | 37 ++++++++++++++++++++----------------- tests/xwfb-script.sh | 31 +++++++++++++++++++++++++++++++ 4 files changed, 58 insertions(+), 20 deletions(-) create mode 100755 tests/xwfb-script.sh diff --git a/ibus-hangul.spec b/ibus-hangul.spec index b855f7c..6ebc76d 100644 --- a/ibus-hangul.spec +++ b/ibus-hangul.spec @@ -3,7 +3,7 @@ Name: ibus-hangul Version: 1.5.5 -Release: 7%{?dist} +Release: 8%{?dist} Summary: The Hangul engine for IBus input platform License: GPL-2.0-or-later URL: https://github.com/libhangul/ibus-hangul @@ -87,6 +87,10 @@ make check \ %{_datadir}/installed-tests/ibus-hangul %changelog +* Mon Dec 9 2024 Peng Wu - 1.5.5-8 +- Update CI tests +- Resolves: RHEL-70370 + * Tue Oct 29 2024 Troy Dawson - 1.5.5-7 - Bump release for October 2024 mass rebuild: Resolves: RHEL-64018 diff --git a/tests/main.fmf b/tests/main.fmf index cdfa408..438530a 100644 --- a/tests/main.fmf +++ b/tests/main.fmf @@ -24,7 +24,8 @@ require: - ibus-hangul - ibus-hangul-tests - rsync - - xorg-x11-server-Xvfb + - xorg-x11-server-Xwayland + - xwayland-run - appstream - libappstream-glib - desktop-file-utils @@ -36,4 +37,3 @@ require: - dbus-x11 - python3-devel - python3-pyxdg - - xorg-x11-server-Xvfb diff --git a/tests/runtest.sh b/tests/runtest.sh index a428125..ae5585f 100755 --- a/tests/runtest.sh +++ b/tests/runtest.sh @@ -2,6 +2,7 @@ . /usr/share/beakerlib/beakerlib.sh || exit 1 NAME=ibus-hangul +XFWB_SCRIPT=$(pwd)/xwfb-script.sh rlJournalStart rlPhaseStartSetup @@ -14,23 +15,25 @@ rlJournalStart rlPhaseEnd rlPhaseStartTest - rlRun "ibus-desktop-testing-runner \ - --no-graphics \ - --runner=gnome \ - --timeout=1500 \ - --tests=${NAME} \ - --output=${NAME}.log \ - --result=test.log \ - " 0 "Running ${NAME} tests" - echo "==== ${NAME}.log: ====" - cat ${NAME}.log - echo "==== EOF ${NAME}.log: ====" - echo "==== test.log ====" - cat test.log - echo "==== EOF test.log: ====" - rlAssertNotGrep FAIL test.log - rlFileSubmit ${NAME}.log - rlFileSubmit test.log + rlRun -t -l "pushd /usr/libexec/installed-tests/ibus-hangul" \ + 0 "Change to directory of installed tests" + if [ -z "${DISPLAY:-}" ]; then + rlLogInfo "DISPLAY is empty or unset." + rlLogInfo "Therefore, use xfwb-run to run the graphical ibus-hangul test:" + rlRun -t -s "xwfb-run -c mutter -e $tmp/xwfb-run.log -n 99 $XFWB_SCRIPT" \ + 0 "Running ibus-hangul test in xfwb-run" + echo "==== START of `cat ${rlRun_LOG}`: log of xwfb-run ====" + cat ${rlRun_LOG} + echo "==== END of `cat ${rlRun_LOG}`: log of xwfb-run ====" + rlAssertNotGrep FAIL ${rlRun_LOG} + rlGetTestState + rlLog "Total number of failed asserts: ${ECODE}" + rlFileSubmit ${rlRun_LOG} + rlFileSubmit xwfb-run.log + fi + rlGetTestState + rlLog "Total number of failed asserts: ${ECODE}" + rlRun "popd" 0 rlPhaseEnd rlPhaseStartCleanup diff --git a/tests/xwfb-script.sh b/tests/xwfb-script.sh new file mode 100755 index 0000000..2c5d48e --- /dev/null +++ b/tests/xwfb-script.sh @@ -0,0 +1,31 @@ +#!/bin/bash +# Run this with `xwfb-run -e /tmp/xwfb-run.log -n 99 xwfb-script.sh` + +# Redirect stderr to stdout: +exec 2>&1 +# without setting GDK_BACKEND=x11, Gtk programs cannot open windows in xfwb-run: +export GDK_BACKEND=x11 +export XDG_SESSION_TYPE=x11 +echo "starting mutter ..." +mutter --x11 & +sleep 5 +echo "mutter started" +ibus-daemon --verbose \ + --replace \ + --single \ + --desktop=mutter \ + --panel=disable \ + --config=disable & +sleep 5 +echo "ibus-daemon started." +/usr/libexec/installed-tests/ibus-hangul/ibus-hangul --tap & +TEST_PID=$! +# A screenshot for debugging can be made here: +#sleep 1 +#import -window root /tmp/screenshot.png +#echo "screenshot done." +# Wait for ibus-hangul tests to finish and get its exit code +wait $TEST_PID +EXIT_CODE=$? +echo "The exit code of ibus-hangul: $EXIT_CODE" +exit $EXIT_CODE