diff options
author | Daiki Ueno <ueno@gnu.org> | 2014-03-26 13:32:22 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@gnu.org> | 2014-03-27 12:58:41 +0900 |
commit | 640988014681be0179cb7f4022cc0d5f51db2ba4 (patch) | |
tree | 60027688d6a15370fd684e2aa19eea3d33ff71bc | |
parent | d9dc7f9fd4130e4a5a58b97fe62c2997f9457df2 (diff) | |
download | external_gettext-640988014681be0179cb7f4022cc0d5f51db2ba4.zip external_gettext-640988014681be0179cb7f4022cc0d5f51db2ba4.tar.gz external_gettext-640988014681be0179cb7f4022cc0d5f51db2ba4.tar.bz2 |
tests: Add tests for autopoint
-rw-r--r-- | gettext-tools/tests/ChangeLog | 8 | ||||
-rw-r--r-- | gettext-tools/tests/Makefile.am | 3 | ||||
-rwxr-xr-x | gettext-tools/tests/autopoint-1 | 91 | ||||
-rwxr-xr-x | gettext-tools/tests/autopoint-2 | 105 | ||||
-rwxr-xr-x | gettext-tools/tests/autopoint-3 | 120 |
5 files changed, 326 insertions, 1 deletions
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 <ueno@gnu.org> + + 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 <ueno@gnu.org> 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..df13369 --- /dev/null +++ b/gettext-tools/tests/autopoint-1 @@ -0,0 +1,91 @@ +#! /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; } + +cat <<\EOF >configure.ac +AC_PREREQ([2.60]) +EOF + +${AUTOCONF} >/dev/null 2>/dev/null \ + || { echo "Skipping test: autoconf version too old"; exit 77; } + +rm -f configure.ac + +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..e90e8d7 --- /dev/null +++ b/gettext-tools/tests/autopoint-2 @@ -0,0 +1,105 @@ +#! /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; } + +cat <<\EOF >configure.ac +AC_PREREQ([2.60]) +EOF + +${AUTOCONF} >/dev/null 2>/dev/null \ + || { echo "Skipping test: autoconf version too old"; exit 77; } + +rm -f configure.ac + +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([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([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 + +rm -fr intl m4 po + +# 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([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..e695f3f --- /dev/null +++ b/gettext-tools/tests/autopoint-3 @@ -0,0 +1,120 @@ +#! /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; } + +cat <<\EOF >configure.ac +AC_PREREQ([2.60]) +EOF + +${AUTOCONF} >/dev/null 2>/dev/null \ + || { echo "Skipping test: autoconf version too old"; exit 77; } + +rm -f configure.ac + +: ${AUTOMAKE=automake} +${AUTOMAKE} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: automake not found"; exit 77; } + +cat <<\EOF >configure.ac +AC_PREREQ([2.60]) +AC_INIT([foo], [0.0], [bug-gnu-gettext@gnu.org]) +AM_INIT_AUTOMAKE([1.11 foreign]) +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT +EOF + +: ${ACLOCAL=aclocal} +${ACLOCAL} >/dev/null 2>/dev/null || exit 1 + +: > Makefile.am + +${AUTOMAKE} --add-missing >/dev/null 2>/dev/null \ + || { echo "Skipping test: automake version too old"; exit 77; } + +rm -f configure.ac Makefile.am + +: ${MAKE=make} +${MAKE} --version >/dev/null 2>/dev/null \ + || { echo "Skipping test: make 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], [bug-gnu-gettext@gnu.org]) +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=autoheader} +${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. +: ${CONFIG_SHELL=${SHELL-/bin/sh}} +${CONFIG_SHELL} ./configure --with-included-gettext >/dev/null 2>/dev/null \ + || exit 1 + +${MAKE} >/dev/null 2>/dev/null || exit 1 + +exit 0 |