Skip to content

Commit

Permalink
Merge branch 'testcases' of https://github.com/epico/ibus-hangul
Browse files Browse the repository at this point in the history
Merge pull request #96

* 'testcases' of https://github.com/epico/ibus-hangul:
  Write runtest script
  Write ibus-hangul.c test case
  Update autoconf to compile ibus-hangul tests

#96
  • Loading branch information
choehwanjin committed Apr 20, 2020
2 parents d47291d + 712b067 commit 24eecbc
Show file tree
Hide file tree
Showing 8 changed files with 472 additions and 5 deletions.
1 change: 1 addition & 0 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

SUBDIRS = \
src \
tests \
setup \
icons \
data \
Expand Down
18 changes: 18 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ PKG_CHECK_MODULES(HANGUL, [
libhangul >= 0.1.0
])

# check gtk
PKG_CHECK_MODULES(GTK, [
gtk+-3.0 >= 3.0.0
])

# check env
AC_PATH_PROG(ENV_PROG, env)
AC_SUBST(ENV_PROG)
Expand All @@ -84,13 +89,26 @@ AC_DEFINE_UNQUOTED(
[Define to the read-only architecture-independent data directory.]
)

# --enable-installed-tests
AC_ARG_ENABLE(installed-tests,
AS_HELP_STRING([--enable-installed-tests],
[Enable to installed tests]),
[enable_installed_tests=$enableval],
[enable_installed_tests=no]
)
AM_CONDITIONAL([ENABLE_INSTALLED_TESTS], [test x"$enable_installed_tests" = x"yes"])
if test x"$enable_installed_tests" = x"no"; then
enable_installed_tests="no (disabled, use --enable-installed-tests to enable)"
fi

# OUTPUT files
AC_CONFIG_FILES([
po/Makefile.in
Makefile
ibus-hangul.spec
src/Makefile
src/hangul.xml.in
tests/Makefile
setup/Makefile
icons/Makefile
data/Makefile
Expand Down
3 changes: 3 additions & 0 deletions ibus-hangul.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ make DESTDIR=${RPM_BUILD_ROOT} install

%find_lang %{name}

%check
make check DISABLE_GUI_TESTS=ibus-hangul

%clean
rm -rf $RPM_BUILD_ROOT

Expand Down
27 changes: 22 additions & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,27 @@ AM_LDFLAGS = \
@HANGUL_LIBS@ \
$(NULL)

noinst_LIBRARIES = \
libinternal.a
$(NULL)

libinternal_a_SOURCES = \
engine.c \
engine.h \
ustring.c \
ustring.h \
i18n.h \
$(NULL)

libinternal_a_CFLAGS = \
@IBUS_CFLAGS@ \
@HANGUL_CFLAGS@ \
-DPKGDATADIR=\"$(pkgdatadir)\" \
-DLOCALEDIR=\"$(localedir)\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
-DIBUSHANGUL_DATADIR=\"$(datadir)/ibus-hangul\" \
$(NULL)

check_PROGRAMS = \
test-ustring
$(NULL)
Expand All @@ -40,11 +61,6 @@ libexec_PROGRAMS = ibus-engine-hangul

ibus_engine_hangul_SOURCES = \
main.c \
engine.c \
engine.h \
ustring.c \
ustring.h \
i18n.h \
$(NULL)

ibus_engine_hangul_CFLAGS = \
Expand All @@ -57,6 +73,7 @@ ibus_engine_hangul_CFLAGS = \
$(NULL)

ibus_engine_hangul_LDADD = \
libinternal.a \
@IBUS_LIBS@ \
@HANGUL_LIBS@ \
$(NULL)
Expand Down
77 changes: 77 additions & 0 deletions tests/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# vim:set noet ts=4:
#
# ibus-hangul - The Hangul engine for IBus
#
# Copyright (c) 2019 Peng Wu <[email protected]>
#
# 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.

TESTS = \
ibus-hangul \
$(NULL)

CLEANFILES = $(test_metas)

EXTRA_DIST = $(test_metas_in) runtest

noinst_PROGRAMS = $(TESTS)

TESTS_ENVIRONMENT = \
top_builddir=$(top_builddir) \
top_srcdir=$(top_srcdir) \
builddir=$(builddir) \
srcdir=$(srcdir) \
LD_LIBRARY_PATH="$(top_builddir)/src/.libs:$(top_builddir)/src" \
DISABLE_GUI_TESTS="$(DISABLE_GUI_TESTS)" \
$(NULL)

LOG_COMPILER = $(srcdir)/runtest
test_metas_in = meta.test.in

if ENABLE_INSTALLED_TESTS
test_execs = ibus-hangul
test_metas = $(addsuffix .test, $(test_execs))
test_sources_DATA = $(test_metas)
test_sourcesdir = $(datadir)/installed-tests/ibus-hangul
test_execs_PROGRAMS = $(TESTS)
test_execsdir = $(libexecdir)/installed-tests/ibus-hangul
endif

ibus_hangul_SOURCES = ibus-hangul.c
ibus_hangul_CFLAGS = \
@IBUS_CFLAGS@ \
@HANGUL_CFLAGS@ \
@GTK_CFLAGS@ \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
-DPKGDATADIR=\"$(pkgdatadir)\" \
-DLOCALEDIR=\"$(localedir)\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
-DIBUSHANGUL_DATADIR=\"$(datadir)/ibus-hangul\" \
$(NULL)

ibus_hangul_LDADD = \
../src/libinternal.a \
@IBUS_LIBS@ \
@HANGUL_LIBS@ \
@GTK_LIBS@ \
$(NULL)

$(test_metas): $(test_metas_in) $(test_programs)
f=`echo $@ | sed -e 's/\.test//'`; \
TEST_EXEC=$(test_execsdir)/$$f; \
sed -e "s|@TEST_EXEC[@]|$$TEST_EXEC|g" $(test_metas_in) > $@.tmp; \
mv $@.tmp $@; \
$(NULL)
Loading

0 comments on commit 24eecbc

Please sign in to comment.