summaryrefslogtreecommitdiff
path: root/tests/Makefile.am
blob: f0ad1822ba06f9c81fc218eef518b8f5623ba0fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# vim:set noet ts=4:
#
# ibus-anthy - The Anthy engine for IBus
#
# Copyright (c) 2017-2018 Takao Fujiwara <takao.fujiwara1@gmail.com>
# Copyright (c) 2017-2018 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

check:
	ARGS="--exit";                                                  \
	if test x$(FORCE_TEST) != x ; then                              \
	    ARGS="$$ARGS --force";                                      \
	fi;                                                             \
	ANTHY_SCHEMA_FILE=org.freedesktop.ibus.engine.anthy.gschema.xml; \
	if test \! -f $(builddir)/../data/$$ANTHY_SCHEMA_FILE ; then    \
	    echo "Not found $(builddir)/../data/$$ANTHY_SCHEMA_FILE";   \
	    exit -1;                                                    \
	fi;                                                             \
	SCHEMA_TMPDIR=`mktemp -d`;                                      \
	if test $$? -ne 0 ; then                                        \
	    echo "FAILED mktemp";                                       \
	    exit -1;                                                    \
	fi;                                                             \
	cp $(builddir)/../data/$$ANTHY_SCHEMA_FILE $$SCHEMA_TMPDIR;     \
	glib-compile-schemas $$SCHEMA_TMPDIR;                           \
	if test $$? -ne 0 ; then                                        \
	    echo "FAILED glib-compile-schemas $$SCHEMA_TMPDIR";         \
	    exit -1;                                                    \
	fi;                                                             \
	if test \! -f $$SCHEMA_TMPDIR/gschemas.compiled ; then          \
	    echo "Not found $$SCHEMA_TMPDIR/gschemas.compiled";         \
	    exit -1;                                                    \
	fi;                                                             \
	ls $(builddir)/../gir/Anthy*.typelib > /dev/null;               \
	if test $$? -ne 0 ; then                                        \
	    echo "Not found $(builddir)/../gir/Anthy*.typelib";         \
	    exit -1;                                                    \
	fi;                                                             \
	ibus-daemon --daemonize --verbose;                              \
	sleep 1;                                                        \
	SUSER=`echo "$$USER" | cut -c 1-7`;                             \
	ps -ef | grep "$$SUSER" | grep ibus | grep -v grep;             \
	export GSETTINGS_SCHEMA_DIR=$$SCHEMA_TMPDIR;                    \
	export GI_TYPELIB_PATH=$(builddir)/../gir;                      \
	LD_LIBRARY_PATH=$(builddir)/../gir/.libs;                       \
	export LD_LIBRARY_PATH=$${LD_LIBRARY_PATH}:$(builddir)/../gir;  \
	echo "#### Starting Python3 API test $$ARGS";                   \
	env IBUS_ANTHY_ENGINE_PATH=$(srcdir)/../engine/python3          \
	    IBUS_ANTHY_SETUP_PATH=$(srcdir)/../setup/python3            \
	python3 -u $(srcdir)/anthytest.py $$ARGS;                       \
	if test $$? -ne 0 ; then                                        \
	    exit -1;                                                    \
	fi;                                                             \
	if test x$(FORCE_TEST) = x ; then                               \
	    rm -r $$HOME/.anthy;                                        \
	fi;                                                             \
	echo "#### Starting Python2 API test";                          \
	env IBUS_ANTHY_ENGINE_PATH=$(srcdir)/../engine/python2          \
	    IBUS_ANTHY_SETUP_PATH=$(srcdir)/../setup/python2            \
	python2 -u $(srcdir)/anthytest.py $$ARGS;                       \
	rm -rf $$SCHEMA_TMPDIR;                                         \
	ibus exit

EXTRA_DIST = \
        anthycases.py \
        anthytest.py \
        $(NULL)