]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
tests: Add tests for autopoint
authorDaiki Ueno <ueno@gnu.org>
Wed, 26 Mar 2014 04:32:22 +0000 (13:32 +0900)
committerDaiki Ueno <ueno@gnu.org>
Thu, 27 Mar 2014 03:58:41 +0000 (12:58 +0900)
gettext-tools/tests/ChangeLog
gettext-tools/tests/Makefile.am
gettext-tools/tests/autopoint-1 [new file with mode: 0755]
gettext-tools/tests/autopoint-2 [new file with mode: 0755]
gettext-tools/tests/autopoint-3 [new file with mode: 0755]

index 1ecaf8fd6e0785e2b7a49a9a90a547d0c62aefe3..ee6c8e2232782236351a33387209dac43c1ade31 100644 (file)
@@ -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.
index 39f561259dbf4979ac4257420f3c24bc65a6b1e5..8978ca0a161bffac0aa2da46a7eef9ad643ff14f 100644 (file)
@@ -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 (executable)
index 0000000..df13369
--- /dev/null
@@ -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 (executable)
index 0000000..e90e8d7
--- /dev/null
@@ -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 (executable)
index 0000000..e695f3f
--- /dev/null
@@ -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