Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test-build.sh: Fix pycotap detection. #35

Closed
wants to merge 1 commit into from

Conversation

Apteryks
Copy link

  • 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.

@Apteryks Apteryks mentioned this pull request Jun 14, 2023
@fujiwarat
Copy link
Member

I think your change does not return any errors even if pycotap is not installed?

@fujiwarat fujiwarat self-requested a review August 22, 2023 03:44
* 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.
@Apteryks
Copy link
Author

Hello! You are right. I've modified my change and tested using edits to the Guix package. Without pycotap available, in the networkless container:

bash -x ./test-build.sh --builddir=. --srcdir=.
+ BUILDDIR=.
+ SRCDIR=.
+ ANTHY_SCHEMA_FILE=org.freedesktop.ibus.engine.anthy.gschema.xml
+ SCHEMA_TMPDIR=
+ FORCE_TEST=
+ RUN_ARGS=
+ main --builddir=. --srcdir=.
+ parse_args --builddir=. --srcdir=.
++ getopt -o hvb:s: --long help,version,builddir:,srcdir: -- --builddir=. --srcdir=.
+ ARGS=' --builddir '\''.'\'' --srcdir '\''.'\'' --'
+ eval set -- ' --builddir '\''.'\'' --srcdir '\''.'\'' --'
++ set -- --builddir . --srcdir . --
+ '[' 1 ']'
+ case "$1" in
+ BUILDDIR=.
+ shift 2
+ '[' 1 ']'
+ case "$1" in
+ SRCDIR=.
+ shift 2
+ '[' 1 ']'
+ case "$1" in
+ shift
+ break
+ init_environment
+ test x '!=' x
+ maybe_install_pycotap
+ test -f /etc/redhat-release
+ python3 -m pycotap
/gnu/store/dy3xh053ahkhrp2jamggq8cpsyvp8mg0-python-3.10.7/bin/python3: No module named pycotap
+ echo 'pycotap not found; installing via pip'
pycotap not found; installing via pip
+ pip install pycotap --user
./test-build.sh: line 78: pip: command not found
+ echo 'failed to install pycotap'
failed to install pycotap
+ exit -1
make[1]: *** [Makefile:663: check] Error 255
make[1]: Leaving directory '/tmp/guix-build-ibus-anthy-1.5.14.drv-0/ibus-anthy-1.5.14/tests'
make: *** [Makefile:526: check-recursive] Error 1

With pycotap installed, the test suite proceeds until it hangs

Making check in tests
make[1]: Entering directory '/tmp/guix-build-ibus-anthy-1.5.14.drv-0/ibus-anthy-1.5.14/tests'
bash -x ./test-build.sh --builddir=. --srcdir=.
+ BUILDDIR=.
+ SRCDIR=.
+ ANTHY_SCHEMA_FILE=org.freedesktop.ibus.engine.anthy.gschema.xml
+ SCHEMA_TMPDIR=
+ FORCE_TEST=
+ RUN_ARGS=
+ main --builddir=. --srcdir=.
+ parse_args --builddir=. --srcdir=.
++ getopt -o hvb:s: --long help,version,builddir:,srcdir: -- --builddir=. --srcdir=.
+ ARGS=' --builddir '\''.'\'' --srcdir '\''.'\'' --'
+ eval set -- ' --builddir '\''.'\'' --srcdir '\''.'\'' --'
++ set -- --builddir . --srcdir . --
+ '[' 1 ']'
+ case "$1" in
+ BUILDDIR=.
+ shift 2
+ '[' 1 ']'
+ case "$1" in
+ SRCDIR=.
+ shift 2
+ '[' 1 ']'
+ case "$1" in
+ shift
+ break
+ init_environment
+ test x '!=' x
+ maybe_install_pycotap
+ test -f /etc/redhat-release
+ python3 -m pycotap
+ test '!' -f ./../data/org.freedesktop.ibus.engine.anthy.gschema.xml
++ mktemp -d
+ SCHEMA_TMPDIR=/tmp/guix-build-ibus-anthy-1.5.14.drv-0/tmp.MDVuxwt740
+ test 0 -ne 0
+ cp ./../data/org.freedesktop.ibus.engine.anthy.gschema.xml /tmp/guix-build-ibus-anthy-1.5.14.drv-0/tmp.MDVuxwt740
+ glib-compile-schemas /tmp/guix-build-ibus-anthy-1.5.14.drv-0/tmp.MDVuxwt740
+ test 0 -ne 0
+ test '!' -f /tmp/guix-build-ibus-anthy-1.5.14.drv-0/tmp.MDVuxwt740/gschemas.compiled
+ ls ./../gir/Anthy-9000.typelib
+ test 0 -ne 0
+ run_ibus_daemon
+ ibus-daemon --daemonize --verbose
+ sleep 1
++ echo ''
++ cut -c 1-7
+ SUSER=
+ ps -ef
+ grep ibus
+ grep -v grep
+ grep ''
nixbld       1     0  7 14:15 ?        00:00:01 guile --no-auto-compile -L /gnu/store/3pmykbk9y59lzpsqzbbn3gk858ypd9jq-module-import -C /gnu/store/d4c37b4jbmyx50zbzr2m1fawwgsrw663-module-import-compiled /gnu/store/mdc2va2b9spymi2d5hhk4l28x93k18hf-ibus-anthy-1.5.14-builder
nixbld    3457  3456  0 14:15 ?        00:00:00 /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash -c fail=; \ if (target_option=k; case ${target_option-} in ?) ;; *) echo "am__make_running_with_option: internal error: invalid" "target option '${target_option-}' specified" >&2; exit 1;; esac; has_opt=no; sane_makeflags=$MAKEFLAGS; if { if test -z '0'; then false; elif test -n 'x86_64-unknown-linux-gnu'; then true; elif test -n '4.3' && test -n '/tmp/guix-build-ibus-anthy-1.5.14.drv-0/ibus-anthy-1.5.14'; then true; else false; fi; }; then sane_makeflags=$MFLAGS; else case $MAKEFLAGS in *\\[\ \?]*) bs=\\; sane_makeflags=`printf '%s\n' "$MAKEFLAGS" | sed "s/$bs$bs[$bs $bs?]*//g"`;; esac; fi; skip_next=no; strip_trailopt () { flg=`printf '%s\n' "$flg" | sed "s/$1.*$//"`; }; for flg in $sane_makeflags; do test $skip_next = yes && { skip_next=no; continue; }; case $flg in *=*|--*) continue;; -*I) strip_trailopt 'I'; skip_next=yes;; -*I?*) strip_trailopt 'I';; -*O) strip_trailopt 'O'; skip_next=yes;; -*O?*) strip_trailopt 'O';; -*l) strip_trailopt 'l'; skip_next=yes;; -*l?*) strip_trailopt 'l';; -[dEDm]) skip_next=yes;; -[JT]) skip_next=yes;; esac; case $flg in *$target_option*) has_opt=yes; break;; esac; done; test $has_opt = yes); then \   failcom='fail=yes'; \ else \   failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo check-recursive | sed s/-recursive//`; \ case "check-recursive" in \   distclean-* | maintainer-clean-*) list='m4 po data gir engine icons setup tests ' ;; \   *) list='m4 po data gir engine icons setup tests ' ;; \ esac; \ for subdir in $list; do \   echo "Making $target in $subdir"; \   if test "$subdir" = "."; then \     dot_seen=yes; \     local_target="$target-am"; \   else \     local_target="$target"; \   fi; \   (CDPATH="${ZSH_VERSION+.}:" && cd $subdir && make  $local_target) \   || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \   make  "$target-am" || exit 1; \ fi; test -z "$fail"
nixbld    3502  3457  0 14:15 ?        00:00:00 /gnu/store/rib9g2ig1xf3kclyl076w28parmncg4k-bash-minimal-5.1.16/bin/bash -c fail=; \ if (target_option=k; case ${target_option-} in ?) ;; *) echo "am__make_running_with_option: internal error: invalid" "target option '${target_option-}' specified" >&2; exit 1;; esac; has_opt=no; sane_makeflags=$MAKEFLAGS; if { if test -z '0'; then false; elif test -n 'x86_64-unknown-linux-gnu'; then true; elif test -n '4.3' && test -n '/tmp/guix-build-ibus-anthy-1.5.14.drv-0/ibus-anthy-1.5.14'; then true; else false; fi; }; then sane_makeflags=$MFLAGS; else case $MAKEFLAGS in *\\[\ \?]*) bs=\\; sane_makeflags=`printf '%s\n' "$MAKEFLAGS" | sed "s/$bs$bs[$bs $bs?]*//g"`;; esac; fi; skip_next=no; strip_trailopt () { flg=`printf '%s\n' "$flg" | sed "s/$1.*$//"`; }; for flg in $sane_makeflags; do test $skip_next = yes && { skip_next=no; continue; }; case $flg in *=*|--*) continue;; -*I) strip_trailopt 'I'; skip_next=yes;; -*I?*) strip_trailopt 'I';; -*O) strip_trailopt 'O'; skip_next=yes;; -*O?*) strip_trailopt 'O';; -*l) strip_trailopt 'l'; skip_next=yes;; -*l?*) strip_trailopt 'l';; -[dEDm]) skip_next=yes;; -[JT]) skip_next=yes;; esac; case $flg in *$target_option*) has_opt=yes; break;; esac; done; test $has_opt = yes); then \   failcom='fail=yes'; \ else \   failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo check-recursive | sed s/-recursive//`; \ case "check-recursive" in \   distclean-* | maintainer-clean-*) list='m4 po data gir engine icons setup tests ' ;; \   *) list='m4 po data gir engine icons setup tests ' ;; \ esac; \ for subdir in $list; do \   echo "Making $target in $subdir"; \   if test "$subdir" = "."; then \     dot_seen=yes; \     local_target="$target-am"; \   else \     local_target="$target"; \   fi; \   (CDPATH="${ZSH_VERSION+.}:" && cd $subdir && make  $local_target) \   || eval $failcom; \ done; \ if test "$dot_seen" = "no"; then \   make  "$target-am" || exit 1; \ fi; test -z "$fail"
nixbld    3512     1 10 14:15 ?        00:00:00 /gnu/store/6gajnw72h3dfmrclbhcl9f1zfij444aa-ibus-1.5.27/bin/ibus-daemon --daemonize --verbose
nixbld    3515  3512  1 14:15 ?        00:00:00 /gnu/store/6gajnw72h3dfmrclbhcl9f1zfij444aa-ibus-1.5.27/libexec/ibus-dconf
nixbld    3516  3512 31 14:15 ?        00:00:00 /gnu/store/6gajnw72h3dfmrclbhcl9f1zfij444aa-ibus-1.5.27/libexec/ibus-ui-gtk3
nixbld    3517  3512 98 14:15 ?        00:00:00 /gnu/store/6gajnw72h3dfmrclbhcl9f1zfij444aa-ibus-1.5.27/libexec/ibus-extension-gtk3
nixbld    3535  3512  1 14:15 ?        00:00:00 /gnu/store/6gajnw72h3dfmrclbhcl9f1zfij444aa-ibus-1.5.27/libexec/ibus-engine-simple
+ run_test_suite
+ export GSETTINGS_SCHEMA_DIR=/tmp/guix-build-ibus-anthy-1.5.14.drv-0/tmp.MDVuxwt740
+ GSETTINGS_SCHEMA_DIR=/tmp/guix-build-ibus-anthy-1.5.14.drv-0/tmp.MDVuxwt740
+ export GI_TYPELIB_PATH=./../gir:/gnu/store/43rpsbfkmis1y5grr05bakv8nkqq2g7n-gtk+-3.24.37/lib/girepository-1.0:/gnu/store/6gajnw72h3dfmrclbhcl9f1zfij444aa-ibus-1.5.27/lib/girepository-1.0:/gnu/store/v0jyv9qjycr5lcc9m018g2g73gv7wv1g-gobject-introspection-1.72.0/lib/girepository-1.0:/gnu/store/rr1vbf04j27z5465wsm1kdfaw3iriz2k-pango-1.50.10/lib/girepository-1.0:/gnu/store/w2jpf8njnqgsq8gl2qnb0gfkrzizvyrv-librsvg-2.54.5/lib/girepository-1.0:/gnu/store/ams35jy7lmxw5xas4b33zznwdx7m1d18-at-spi2-core-2.45.90/lib/girepository-1.0:/gnu/store/n7vynkl0rkqmvahxji6530n8hmfscxsd-harfbuzz-5.3.1/lib/girepository-1.0:/gnu/store/1ig678c8vqxvr60x8swmc5wriga7sjf3-gdk-pixbuf-2.42.8/lib/girepository-1.0
+ GI_TYPELIB_PATH=./../gir:/gnu/store/43rpsbfkmis1y5grr05bakv8nkqq2g7n-gtk+-3.24.37/lib/girepository-1.0:/gnu/store/6gajnw72h3dfmrclbhcl9f1zfij444aa-ibus-1.5.27/lib/girepository-1.0:/gnu/store/v0jyv9qjycr5lcc9m018g2g73gv7wv1g-gobject-introspection-1.72.0/lib/girepository-1.0:/gnu/store/rr1vbf04j27z5465wsm1kdfaw3iriz2k-pango-1.50.10/lib/girepository-1.0:/gnu/store/w2jpf8njnqgsq8gl2qnb0gfkrzizvyrv-librsvg-2.54.5/lib/girepository-1.0:/gnu/store/ams35jy7lmxw5xas4b33zznwdx7m1d18-at-spi2-core-2.45.90/lib/girepository-1.0:/gnu/store/n7vynkl0rkqmvahxji6530n8hmfscxsd-harfbuzz-5.3.1/lib/girepository-1.0:/gnu/store/1ig678c8vqxvr60x8swmc5wriga7sjf3-gdk-pixbuf-2.42.8/lib/girepository-1.0
+ LD_LIBRARY_PATH=./../gir/.libs
+ export LD_LIBRARY_PATH=./../gir/.libs:./../gir
+ LD_LIBRARY_PATH=./../gir/.libs:./../gir
+ export GTK_IM_MODULE=ibus
+ GTK_IM_MODULE=ibus
+ for i in 3
+ echo '#### Starting Python3 API test '
#### Starting Python3 API test 
+ env IBUS_ANTHY_ENGINE_PATH=./../engine/python3 IBUS_ANTHY_SETUP_PATH=./../setup/python3 python3 -u ./anthytest.py
## Load pycotap
## Registering engine

(anthytest.py:3552): IBUS-WARNING **: 14:15:23.820: Unable to load /var/lib/dbus/machine-id: Failed to open file “/var/lib/dbus/machine-id”: No such file or directory
## Map window
## Build window
<frozen importlib._bootstrap>:671: ImportWarning: DynamicImporter.exec_module() not found; falling back to load_module()
[hangs here]

So it seems to work as intended now.

@fujiwarat fujiwarat added the test label Aug 23, 2023
@fujiwarat fujiwarat added this to the 1.5.16 milestone Aug 23, 2023
fujiwarat pushed a commit to fujiwarat/ibus-anthy that referenced this pull request Aug 23, 2023
* 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=ibus#35
@fujiwarat
Copy link
Member

Thank you for the patch. I modified the pip part after I integrated this patch.

@fujiwarat fujiwarat closed this Aug 23, 2023
@fujiwarat
Copy link
Member

I integrated this patch in the devel repo and it will be migrate to ibus/ibus-anthy repo when the new version is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants