--- gettext-tools/tests/ChangeLog | 8 ++++ gettext-tools/tests/Makefile.am | 3 +- gettext-tools/tests/autopoint-1 | 82 ++++++++++++++++++++++++++++++++++ gettext-tools/tests/autopoint-2 | 97 +++++++++++++++++++++++++++++++++++++++++ gettext-tools/tests/autopoint-3 | 94 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 283 insertions(+), 1 deletion(-) create mode 100755 gettext-tools/tests/autopoint-1 create mode 100755 gettext-tools/tests/autopoint-2 create mode 100755 gettext-tools/tests/autopoint-3
diff --git a/gettext-tools/tests/ChangeLog b/gettext-tools/tests/ChangeLog index 1ecaf8f..ee6c8e2 100644 --- a/gettext-tools/tests/ChangeLog +++ b/gettext-tools/tests/ChangeLog @@ -1,3 +1,11 @@ +2014-03-26 Daiki Ueno <[email protected]> + + tests: Add tests for autopoint + * autopoint-1: New file. + * autopoint-2: New file. + * autopoint-3: New file. + * Makefile.am (TESTS): Add new tests. + 2014-03-25 Daiki Ueno <[email protected]> Add tests for --add-location=file option. diff --git a/gettext-tools/tests/Makefile.am b/gettext-tools/tests/Makefile.am index 39f5612..8978ca0 100644 --- a/gettext-tools/tests/Makefile.am +++ b/gettext-tools/tests/Makefile.am @@ -137,7 +137,8 @@ TESTS = gettext-1 gettext-2 gettext-3 gettext-4 gettext-5 gettext-6 gettext-7 \ lang-python-2 lang-clisp lang-elisp lang-librep lang-guile \ lang-smalltalk lang-java lang-csharp lang-gawk lang-pascal \ lang-ycp lang-tcl lang-perl-1 lang-perl-2 lang-php lang-po lang-rst \ - lang-lua lang-javascript lang-vala + lang-lua lang-javascript lang-vala \ + autopoint-1 autopoint-2 autopoint-3 EXTRA_DIST += init.sh init.cfg $(TESTS) \ test.mo xg-c-1.ok.po mex-test2.ok \ diff --git a/gettext-tools/tests/autopoint-1 b/gettext-tools/tests/autopoint-1 new file mode 100755 index 0000000..1139f60 --- /dev/null +++ b/gettext-tools/tests/autopoint-1 @@ -0,0 +1,82 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test for sanity checks. + +: ${AUTOCONF=autoconf} +${AUTOCONF} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: autoconf not found"; exit 77; } + +gettext_dir=$top_builddir/misc +export gettext_dir + +# Check if sanity checks are actually working. + +# no configure.ac +$gettext_dir/autopoint 2>&1 | grep -q 'Missing configure.in or configure.ac' \ + || exit 1 + +test ! -d intl || exit 1 +test ! -d m4 || exit 1 +test ! -d po || exit 1 + +# configure.ac without AM_GNU_GETTEXT_VERSION +cat <<\EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +EOF + +$gettext_dir/autopoint 2>&1 | grep -q 'Missing version' \ + || exit 1 + +test ! -d intl || exit 1 +test ! -d m4 || exit 1 +test ! -d po || exit 1 + +# VERSION specified through intl/VERSION file, but in wrong format +cat <<\EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +EOF + +test -d intl || mkdir intl +echo bogus-version > intl/VERSION + +$gettext_dir/autopoint 2>&1 | grep -q 'Missing version' \ + || exit 1 + +test ! -d m4 || exit 1 +test ! -d po || exit 1 + +# VERSION specified through intl/VERSION file +cat <<\EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +EOF + +test -d intl || mkdir intl +echo gettext-0.15 > intl/VERSION + +$gettext_dir/autopoint 2>&1 | grep -q 'locally modified' || exit 1 + +test ! -d m4 || exit 1 +test ! -d po || exit 1 + +rm -fr intl + +exit 0 diff --git a/gettext-tools/tests/autopoint-2 b/gettext-tools/tests/autopoint-2 new file mode 100755 index 0000000..5cf907d --- /dev/null +++ b/gettext-tools/tests/autopoint-2 @@ -0,0 +1,97 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test the autopoint program, without Automake. + +required_gettext_version=0.18.2 + +: ${AUTOCONF=autoconf} +${AUTOCONF} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: autoconf not found"; exit 77; } + +gettext_dir=$top_builddir/misc +export gettext_dir + +# Check for not copying libintl source. +cat <<EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([$required_gettext_version]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([m4/Makefile]) +AC_CONFIG_FILES([po/Makefile.in]) +AC_OUTPUT +EOF + +$gettext_dir/autopoint >/dev/null 2>/dev/null || exit 1 + +test ! -d intl || exit 1 +test -d m4 || exit 1 +test -d po || exit 1 + +test -f m4/po.m4 || exit 1 +test -f po/Makefile.in.in || exit 1 + +rm -fr m4 po + +# Check for copying libintl source. +cat <<EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC +AM_GNU_GETTEXT +AM_GNU_GETTEXT_VERSION([$required_gettext_version]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([m4/Makefile]) +AC_CONFIG_FILES([po/Makefile.in]) +AC_OUTPUT +EOF + +$gettext_dir/autopoint >/dev/null 2>/dev/null || exit 1 + +test -d intl || exit 1 +test -d m4 || exit 1 +test -d po || exit 1 + +test -f intl/VERSION || exit 1 +test -f m4/po.m4 || exit 1 +test -f po/Makefile.in.in || exit 1 + +# Check for custom macro directory. +cat <<EOF >configure.ac +AC_INIT +AC_CONFIG_SRCDIR(hello.c) + +AC_PROG_CC +AM_GNU_GETTEXT([external]) +AM_GNU_GETTEXT_VERSION([$required_gettext_version]) + +# first macro directory, in which po.m4, etc. belong +AC_CONFIG_MACRO_DIR([gettext-m4]) + +# second macro directory +AC_CONFIG_MACRO_DIR([m4]) + +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([gettext-m4/Makefile]) +AC_CONFIG_FILES([po/Makefile.in]) +AC_OUTPUT +EOF + +$gettext_dir/autopoint >/dev/null 2>/dev/null || exit 1 + +test ! -d intl || exit 1 +test ! -d m4 || exit 1 +test -d gettext-m4 || exit 1 +test -d po || exit 1 + +test -f gettext-m4/po.m4 || exit 1 +test -f po/Makefile.in.in || exit 1 + +rm -fr gettext-m4 po diff --git a/gettext-tools/tests/autopoint-3 b/gettext-tools/tests/autopoint-3 new file mode 100755 index 0000000..b1a8542 --- /dev/null +++ b/gettext-tools/tests/autopoint-3 @@ -0,0 +1,94 @@ +#! /bin/sh +. "${srcdir=.}/init.sh"; path_prepend_ . ../src + +# Test the autopoint program, with Automake. + +required_gettext_version=0.18.3 + +: ${AUTOCONF=autoconf} +${AUTOCONF} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: autoconf not found"; exit 77; } + +: ${AUTOHEADER=autoheader} +${AUTOHEADER} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: autoheader not found"; exit 77; } + +: ${ACLOCAL=aclocal} +${ACLOCAL} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: aclocal not found"; exit 77; } + +: ${AUTOMAKE=automake} +${AUTOMAKE} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: automake not found"; exit 77; } + +gettext_dir=$top_builddir/misc +export gettext_dir + +cat <<EOF >configure.ac +AC_CONFIG_MACRO_DIR([m4]) + +AC_INIT([hello], [0.0.0], [[email protected]]) +AM_INIT_AUTOMAKE([foreign]) + +AC_PROG_CC +AM_GNU_GETTEXT +AM_GNU_GETTEXT_VERSION([$required_gettext_version]) + +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_FILES([intl/Makefile]) +AC_CONFIG_FILES([po/Makefile.in]) +AC_OUTPUT +EOF + +cat <<\EOF >Makefile.am +# Example for use of GNU gettext. +# This file is in the public domain. +# +# Makefile configuration - processed by automake. + +# The list of subdirectories containing Makefiles. +SUBDIRS = intl po + +# The list of programs that are built. +bin_PROGRAMS = hello + +# The source files of the 'hello' program. +hello_SOURCES = hello.c gettext.h + +# Define a C macro LOCALEDIR indicating where catalogs will be installed. +DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ + +# Make sure the gettext.h include file is found. +AM_CPPFLAGS = -I. -I$(srcdir) + +# Link time dependencies. +LDADD = @LIBINTL@ +EOF + +cp -p "$abs_top_srcdir"/gnulib-lib/gettext.h . +cp -p "$abs_top_srcdir"/examples/hello-c/hello.c . + +$gettext_dir/autopoint -f >/dev/null 2>/dev/null || exit 1 + +test -d intl || exit 1 +test -d m4 || exit 1 +test -d po || exit 1 + +test -f m4/po.m4 || exit 1 +test -f po/Makefile.in.in || exit 1 + +cp -p po/Makevars.template po/Makevars +echo hello.c > po/POTFILES.in + +${ACLOCAL} -I m4 >/dev/null 2>/dev/null || exit 1 +${AUTOHEADER} >/dev/null 2>/dev/null || exit 1 +${AUTOCONF} >/dev/null 2>/dev/null || exit 1 +${AUTOMAKE} -a -c >/dev/null 2>/dev/null || exit 1 + +# Check if libintl compiles. +./configure --with-included-gettext >/dev/null 2>/dev/null || exit 1 + +make >/dev/null 2>/dev/null || exit 1 + +exit 0 -- 1.8.4.2
