diff options
author | fujiwarat <takao.fujiwara1@gmail.com> | 2018-10-26 18:44:35 +0900 |
---|---|---|
committer | fujiwarat <takao.fujiwara1@gmail.com> | 2018-10-26 18:44:35 +0900 |
commit | c1b55431c076dfa3fc26a3a998bfcf729e9ba602 (patch) | |
tree | 4c8aa1442264b03382de4f86984e7f62ac29407f | |
parent | a6710817b3d29d6a522f108f96ffe64d2f5367fe (diff) | |
download | ibus-c1b55431c076dfa3fc26a3a998bfcf729e9ba602.tar.gz |
src/tests: Fix make check in Fedora 29
ibus-bus and ibus-compose failed in Fedora 29.
1. In ibus-bus with runtest, ibus-daemon failed to restart in
start_exit_async() because it seems to have conflicting IO with runtest
and ibus-daemon failed to close a file descriptor in _restart_server().
The solution is to add a sleep in start_exit_async().
Also added ibus_get_address() in test_async_apis_finish() to check
if ibus-daemon finished to restart.
2. In ibus-compose, the GTK application could not get the ibus module.
The solution is to export GTK_IM_MODULE=ibus.
3. Added DISABLE_DAEMONIZE_IN_TESTS to get error messages in ibus-daemon.
% make DISABLE_DAEMONIZE_IN_TESTS=1 check
-rw-r--r-- | bus/Makefile.am | 1 | ||||
-rw-r--r-- | src/tests/Makefile.am | 1 | ||||
-rw-r--r-- | src/tests/ibus-bus.c | 15 | ||||
-rwxr-xr-x | src/tests/runtest | 24 |
4 files changed, 33 insertions, 8 deletions
diff --git a/bus/Makefile.am b/bus/Makefile.am index bdae5c92..4383a874 100644 --- a/bus/Makefile.am +++ b/bus/Makefile.am @@ -124,6 +124,7 @@ TESTS_ENVIRONMENT = \ srcdir=$(srcdir) \ LD_LIBRARY_PATH="$(top_builddir)/src/.libs:$(top_builddir)/src" \ DISABLE_GUI_TESTS="$(DISABLE_GUI_TESTS)" \ + DISABLE_DAEMONIZE_IN_TESTS="$(DISABLE_DAEMONIZE_IN_TESTS)" \ $(NULL) LOG_COMPILER = $(top_srcdir)/src/tests/runtest diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index c5fef3c8..e337a59b 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -73,6 +73,7 @@ TESTS_ENVIRONMENT = \ srcdir=$(srcdir) \ LD_LIBRARY_PATH="$(top_builddir)/src/.libs:$(top_builddir)/src" \ DISABLE_GUI_TESTS="$(DISABLE_GUI_TESTS)" \ + DISABLE_DAEMONIZE_IN_TESTS="$(DISABLE_DAEMONIZE_IN_TESTS)" \ $(NULL) LOG_COMPILER = $(srcdir)/runtest diff --git a/src/tests/ibus-bus.c b/src/tests/ibus-bus.c index 7fa1bc4a..0bf9e612 100644 --- a/src/tests/ibus-bus.c +++ b/src/tests/ibus-bus.c @@ -820,6 +820,14 @@ finish_exit_async (GObject *source_object, static void start_exit_async (void) { + /* When `./runtest ibus-bus` runs, ibus-daemon sometimes failed to + * restart because closing a file descriptor was failed in + * bus/server.c:_restart_server() with a following error: + * "inotify read(): Bad file descriptor" + * Now g_usleep() is added here to write down the buffer and not to + * fail to restart ibus-daemon. + */ + g_usleep (G_USEC_PER_SEC); ibus_bus_exit_async (bus, TRUE, /* restart */ -1, /* timeout */ @@ -831,6 +839,9 @@ start_exit_async (void) static gboolean test_async_apis_finish (gpointer user_data) { + /* INFO: g_warning() causes SEGV with runtest script */ + if (ibus_get_address () == NULL) + g_warning ("ibus-daemon does not restart yet from start_exit_async()."); ibus_quit (); return FALSE; } @@ -906,7 +917,9 @@ call_next_async_function (void) }; static guint index = 0; - // Use g_timeout_add to make sure test_async_apis finishes even if async_functions is empty. + /* Use g_timeout_add to make sure test_async_apis finishes even if + * async_functions is empty. + */ if (index >= G_N_ELEMENTS (async_functions)) g_timeout_add (1, test_async_apis_finish, NULL); else diff --git a/src/tests/runtest b/src/tests/runtest index d7f96ea3..ab39e9f2 100755 --- a/src/tests/runtest +++ b/src/tests/runtest @@ -22,6 +22,7 @@ : ${builddir:=.} : ${srcdir:=.} : ${DISABLE_GUI_TESTS:=''} +: ${DISABLE_DAEMONIZE_IN_TESTS:=''} BUS_REQUIRED_TESTS=" ibus-bus @@ -162,16 +163,25 @@ run_test_case() export GSETTINGS_SCHEMA_DIR=$PWD # Start ibus-daemon. - ../$top_builddir/bus/ibus-daemon \ - --daemonize \ - --cache=none \ - --panel=disable \ - --emoji-extension=disable \ - --config=default \ - --verbose; + DAEMON_ARGS=' + --cache=none + --panel=disable + --emoji-extension=disable + --config=default + --verbose + ' + if test x"$DISABLE_DAEMONIZE_IN_TESTS" = x ; then + ../$top_builddir/bus/ibus-daemon \ + $DAEMON_ARGS --daemonize; + else + ../$top_builddir/bus/ibus-daemon \ + $DAEMON_ARGS & + fi # Wait until all necessary components are up. sleep 1 + + export GTK_IM_MODULE=ibus fi "../$tst" ${1+"$@"} |