Fix make check with GitHub action

This commit is contained in:
Takao Fujiwara 2024-01-31 12:02:43 +09:00
parent b3293cdd26
commit 7bb64e22eb
2 changed files with 211 additions and 1 deletions

View File

@ -1,3 +1,116 @@
From b279e156ea219833af7515ffa588c82889a1fa73 Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Date: Wed, 23 Aug 2023 11:17:02 +0900
Subject: [PATCH 1/2] test-build.sh: Fix pycotap detection
* tests/test-build.sh (init_environment): Extract pycotap checks to...
(maybe_install_pycotap): ... this new procedure. Test if it runs
successfully directly instead of looking into the Python --user-site.
BUG=https://github.com/ibus/ibus-anthy/pull/35
---
tests/test-build.sh | 37 ++++++++++++++++++++++---------------
1 file changed, 22 insertions(+), 15 deletions(-)
diff --git a/tests/test-build.sh b/tests/test-build.sh
index e83b78f..bbfa7e1 100755
--- a/tests/test-build.sh
+++ b/tests/test-build.sh
@@ -63,26 +63,33 @@ parse_args()
done;
}
+maybe_install_pycotap() {
+ # Red Hat specific hint.
+ if test -f /etc/redhat-release ; then
+ if ! rpm -q --quiet python3-pycotap; then
+ echo "Please install python3-pycotap"
+ exit -1
+ fi
+ fi;
+
+ # Check if pycotap is already available.
+ if ! python3 -m pycotap >/dev/null; then
+ echo "pycotap not found; installing via pip"
+ if ! pip install pycotap --user; then
+ echo "failed to install pycotap"
+ exit -1
+ fi
+ fi
+}
+
init_environment()
{
if test x$FORCE_TEST != x ; then
RUN_ARGS="$RUN_ARGS --force";
fi;
- HAS_TAP=0;
- if test -f /etc/redhat-release ; then
- rpm -q --quiet python3-pycotap
- if test $? -ne 0 ; then
- echo "Not found python3-pycotap";
- exit -1;
- fi;
- HAS_TAP=1;
- fi;
- TAP_DIR=`python -m site --user-site`/pycotap;
- if test $HAS_TAP -ne 1 && \
- test x"$TAP_DIR" != x && test ! -d "$TAP_DIR" ; then
- echo "pip install pycotap --user";
- pip install pycotap --user;
- fi;
+
+ maybe_install_pycotap
+
if test ! -f $BUILDDIR/../data/$ANTHY_SCHEMA_FILE ; then
echo "Not found $BUILDDIR/../data/$ANTHY_SCHEMA_FILE";
exit -1;
--
2.43.0
From 678e1f0f03fe2361153e58930b5339f5a04fcc70 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 23 Aug 2023 11:27:16 +0900
Subject: [PATCH 2/2] tests: Run ibus-daemon without panel
ibus-panel package has been separated since Fedora 39 and this test
does not need ibus-panel.
Also checks pip3.
---
tests/test-build.sh | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/tests/test-build.sh b/tests/test-build.sh
index bbfa7e1..78c8e04 100755
--- a/tests/test-build.sh
+++ b/tests/test-build.sh
@@ -74,8 +74,12 @@ maybe_install_pycotap() {
# Check if pycotap is already available.
if ! python3 -m pycotap >/dev/null; then
- echo "pycotap not found; installing via pip"
- if ! pip install pycotap --user; then
+ PIP=pip3
+ if ! command -v $PIP &> /dev/null ; then
+ PIP=pip
+ fi
+ echo "pycotap not found; installing via $PIP"
+ if ! $PIP install pycotap --user; then
echo "failed to install pycotap"
exit -1
fi
@@ -118,7 +122,7 @@ init_environment()
run_ibus_daemon()
{
- ibus-daemon --daemonize --verbose;
+ ibus-daemon --daemonize --verbose --panel disable;
sleep 1;
SUSER=`echo "$USER" | cut -c 1-7`;
ps -ef | grep "$SUSER" | grep ibus | grep -v grep;
--
2.43.0
From 137f5d7b0eff9a6e631685a567d06b992146e362 Mon Sep 17 00:00:00 2001 From 137f5d7b0eff9a6e631685a567d06b992146e362 Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com> From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Thu, 7 Sep 2023 12:57:47 +0900 Date: Thu, 7 Sep 2023 12:57:47 +0900
@ -122,3 +235,97 @@ index 7f7bd1b..8750bc5 100644
-- --
2.43.0 2.43.0
From 16ba437ea9e72685f9ac3bce7000c4e9b4bd2e7b Mon Sep 17 00:00:00 2001
From: fujiwarat <takao.fujiwara1@gmail.com>
Date: Wed, 31 Jan 2024 10:44:48 +0900
Subject: [PATCH] tests: Fix make check with GitHub action
The test scripts invoke anthytest.py whose unittest can skip tests
unless Display is available and the return value has been changed
since Python 3.12.1
No pycotap.__main__ and cannot be directly executed with `-m` option.
Fedora 39 Docker does not provide USER environment variable.
Fixes: https://github.com/ibus/ibus-anthy/commit/b279e15
---
tests/test-build.sh | 14 ++++++++++----
tests/test-console.sh | 8 ++++++--
2 files changed, 16 insertions(+), 6 deletions(-)
diff --git a/tests/test-build.sh b/tests/test-build.sh
index 78c8e04..4f6a5f7 100755
--- a/tests/test-build.sh
+++ b/tests/test-build.sh
@@ -28,6 +28,8 @@ ANTHY_SCHEMA_FILE=org.freedesktop.ibus.engine.anthy.gschema.xml;
SCHEMA_TMPDIR="";
FORCE_TEST="";
RUN_ARGS="";
+# Fedora 39 Docker does not provide USER
+USER=${USER:-`id | sed -e "s/uid=[0-9]*(\([^)]*\)).*/\1/"`};
usage()
{
@@ -73,7 +75,8 @@ maybe_install_pycotap() {
fi;
# Check if pycotap is already available.
- if ! python3 -m pycotap >/dev/null; then
+ # No pycotap.__main__ and cannot be directly executed with `-m` option
+ if ! python3 -c "import pycotap"; then
PIP=pip3
if ! command -v $PIP &> /dev/null ; then
PIP=pip
@@ -122,7 +125,8 @@ init_environment()
run_ibus_daemon()
{
- ibus-daemon --daemonize --verbose --panel disable;
+ # this script can run without Display
+ ibus-daemon --daemonize --verbose --panel disable --emoji-extension disable;
sleep 1;
SUSER=`echo "$USER" | cut -c 1-7`;
ps -ef | grep "$SUSER" | grep ibus | grep -v grep;
@@ -141,8 +145,10 @@ run_test_suite()
env IBUS_ANTHY_ENGINE_PATH=$SRCDIR/../engine/python$i \
IBUS_ANTHY_SETUP_PATH=$SRCDIR/../setup/python$i \
python$i -u $SRCDIR/anthytest.py $RUN_ARGS;
- if test $? -ne 0 ; then
- exit -1;
+ RETVAL=$?
+ # Return 5 with "NO TESTS RAN" in unittest/runner.py since python 3.12.1
+ if test $RETVAL -ne 0 && test $RETVAL -ne 5; then
+ exit 1;
fi;
if test x$FORCE_TEST = x ; then
rm -r $HOME/.anthy;
diff --git a/tests/test-console.sh b/tests/test-console.sh
index 374afa8..0116ae2 100755
--- a/tests/test-console.sh
+++ b/tests/test-console.sh
@@ -34,6 +34,8 @@ PID_XORG=0;
PID_GNOME_SESSION=0;
FORCE_TEST="";
RUN_ARGS="--exit";
+# Fedora 39 Docker does not provide USER
+USER=${USER:-`id | sed -e "s/uid=[0-9]*(\([^)]*\)).*/\1/"`};
usage()
{
@@ -152,8 +154,10 @@ run_test_suite()
echo "#### Starting $PYTHON API test $RUN_ARGS";
export GTK_IM_MODULE=ibus
$PYTHON -u $SRCDIR/anthytest.py $RUN_ARGS;
- if test $? -ne 0 ; then
- exit -1;
+ RETVAL=$?
+ # Return 5 with "NO TESTS RAN" in unittest/runner.py since python 3.12.1
+ if test $RETVAL -ne 0 && test $RETVAL -ne 5; then
+ exit 1;
fi;
if test x$FORCE_TEST = x ; then
for ANTHY_CONFIG in ".anthy" ".config/anthy" ; do
--
2.43.0

View File

@ -18,7 +18,7 @@
Name: ibus-anthy Name: ibus-anthy
Version: 1.5.15 Version: 1.5.15
Release: 5%{?dist} Release: 6%{?dist}
Summary: The Anthy engine for IBus input platform Summary: The Anthy engine for IBus input platform
License: GPL-2.0-or-later License: GPL-2.0-or-later
URL: https://github.com/ibus/ibus/wiki URL: https://github.com/ibus/ibus/wiki
@ -157,6 +157,9 @@ make -C data check
%{_datadir}/installed-tests/%{name} %{_datadir}/installed-tests/%{name}
%changelog %changelog
* Wed Jan 31 2024 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-6
- Fix make check with GitHub action
* Tue Jan 30 2024 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-5 * Tue Jan 30 2024 Takao Fujiwara <tfujiwar@redhat.com> - 1.5.15-5
- Resolves #2261242 Update era.t with 2024 - Resolves #2261242 Update era.t with 2024
- Add appstream-util validattion - Add appstream-util validattion