]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
New subdirectory system-tests.
authorBruno Haible <bruno@clisp.org>
Sun, 21 Oct 2018 08:35:25 +0000 (10:35 +0200)
committerBruno Haible <bruno@clisp.org>
Sun, 21 Oct 2018 20:14:45 +0000 (22:14 +0200)
* gettext-tools/system-tests/Makefile.am: New file.
* gettext-tools/system-tests/README: New file.
* gettext-tools/system-tests/run-test: New file.
* gettext-tools/system-tests/testlocale.c: New file.
* gettext-tools/system-tests/intl-1-prg.c: New file.
* gettext-tools/system-tests/intl-3-prg.c: New file.
* gettext-tools/system-tests/intl-4-prg.c: New file.
* gettext-tools/system-tests/intl-5-prg.c: New file.
* gettext-tools/system-tests/intl-setlocale-1-prg.c: New file.
* gettext-tools/system-tests/intl-setlocale-2-prg.c: New file.
* gettext-tools/system-tests/intl-thread-1-prg.c: New file.
* gettext-tools/system-tests/intl-thread-2-prg.c: New file.
* gettext-tools/system-tests/intl-thread-3-prg.c: New file.
* gettext-tools/system-tests/format-c-3-prg.c: New file.
* gettext-tools/system-tests/format-c-4-prg.c: New file.
* gettext-tools/system-tests/format-c-5-prg.c: New file.
* gettext-tools/system-tests/plural-1-prg.c: New file.
* gettext-tools/Makefile.am (SUBDIRS): Add system-tests.
* gettext-tools/configure.ac (TEST_SYSTEM_LIBINTL): New conditional.
(AC_CONFIG_FILES): Add system-tests/Makefile.
* gettext-tools/tests/init.cfg: Include init-env from the tests/ directory.
* gettext-tools/tests/intl-5-prg.c: When USE_SYSTEM_LIBINTL is defined, use the
system's <libintl.h>.
* gettext-tools/tests/intl-setlocale-1-prg.c: Likewise.
* gettext-tools/tests/intl-setlocale-2-prg.c: Likewise.
* gettext-tools/tests/intl-thread-1-prg.c: Likewise.
* gettext-tools/tests/intl-thread-2-prg.c: Likewise.
* gettext-tools/tests/intl-thread-3-prg.c: Likewise.
* gettext-tools/tests/intl-1-prg.c: When USE_SYSTEM_LIBINTL is defined, use the
system's <libintl.h>.
* gettext-tools/tests/intl-3-prg.c: Likewise.
* gettext-tools/tests/intl-4-prg.c: Likewise.
* gettext-tools/tests/format-c-3-prg.c: Likewise.
* gettext-tools/tests/format-c-4-prg.c: Likewise.
* gettext-tools/tests/plural-1-prg.c: Likewise.
* gettext-tools/tests/format-c-5-prg.c: When USE_SYSTEM_LIBINTL is defined, use
the system's <libintl.h> and setenv instead of xsetenv, and no fake setlocale.
* gettext-tools/tests/format-c-3: When USE_SYSTEM_LIBINTL is defined, try
$LOCALE_FR and $LOCALE_FR_UTF8.
* gettext-tools/tests/format-c-4: Likewise.
* gettext-tools/tests/plural-1: Likewise.
* gettext-tools/tests/format-c-5: When USE_SYSTEM_LIBINTL is defined, try fa_IR
and fa_IR.UTF-8.

38 files changed:
.gitignore
gettext-tools/Makefile.am
gettext-tools/configure.ac
gettext-tools/system-tests/Makefile.am [new file with mode: 0644]
gettext-tools/system-tests/README [new file with mode: 0644]
gettext-tools/system-tests/format-c-3-prg.c [new file with mode: 0644]
gettext-tools/system-tests/format-c-4-prg.c [new file with mode: 0644]
gettext-tools/system-tests/format-c-5-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-1-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-3-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-4-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-5-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-setlocale-1-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-setlocale-2-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-thread-1-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-thread-2-prg.c [new file with mode: 0644]
gettext-tools/system-tests/intl-thread-3-prg.c [new file with mode: 0644]
gettext-tools/system-tests/plural-1-prg.c [new file with mode: 0644]
gettext-tools/system-tests/run-test [new file with mode: 0755]
gettext-tools/system-tests/testlocale.c [new file with mode: 0644]
gettext-tools/tests/format-c-3
gettext-tools/tests/format-c-3-prg.c
gettext-tools/tests/format-c-4
gettext-tools/tests/format-c-4-prg.c
gettext-tools/tests/format-c-5
gettext-tools/tests/format-c-5-prg.c
gettext-tools/tests/init.cfg
gettext-tools/tests/intl-1-prg.c
gettext-tools/tests/intl-3-prg.c
gettext-tools/tests/intl-4-prg.c
gettext-tools/tests/intl-5-prg.c
gettext-tools/tests/intl-setlocale-1-prg.c
gettext-tools/tests/intl-setlocale-2-prg.c
gettext-tools/tests/intl-thread-1-prg.c
gettext-tools/tests/intl-thread-2-prg.c
gettext-tools/tests/intl-thread-3-prg.c
gettext-tools/tests/plural-1
gettext-tools/tests/plural-1-prg.c

index 2c796d4e3efbd03ac54d17254aa4f7ca7ce6b8b6..24772d8a2e69f55e85c782931fb4a64b7f891532 100644 (file)
 /gettext-tools/projects/Makefile.in
 /gettext-tools/src/Makefile.in
 /gettext-tools/styles/Makefile.in
+/gettext-tools/system-tests/Makefile.in
 /gettext-tools/tests/Makefile.in
 /gnulib-local/Makefile.in
 
@@ -553,6 +554,7 @@ autom4te.cache/
 /gettext-tools/src/Makefile
 /gettext-tools/src/user-email
 /gettext-tools/styles/Makefile
+/gettext-tools/system-tests/Makefile
 /gettext-tools/tests/Makefile
 /gettext-tools/tests/init-env
 /gnulib-local/Makefile
@@ -651,6 +653,34 @@ autom4te.cache/
 /gettext-tools/src/gnu.gettext.DumpResource.exe
 /gettext-tools/src/gnu.gettext.GetURL
 /gettext-tools/src/gnu.gettext.GetURL.exe
+/gettext-tools/system-tests/cake
+/gettext-tools/system-tests/cake.exe
+/gettext-tools/system-tests/fc3
+/gettext-tools/system-tests/fc3.exe
+/gettext-tools/system-tests/fc4
+/gettext-tools/system-tests/fc4.exe
+/gettext-tools/system-tests/fc5
+/gettext-tools/system-tests/fc5.exe
+/gettext-tools/system-tests/intl-1-prg
+/gettext-tools/system-tests/intl-1-prg.exe
+/gettext-tools/system-tests/intl-3-prg
+/gettext-tools/system-tests/intl-3-prg.exe
+/gettext-tools/system-tests/intl-4-prg
+/gettext-tools/system-tests/intl-4-prg.exe
+/gettext-tools/system-tests/intl-5-prg
+/gettext-tools/system-tests/intl-5-prg.exe
+/gettext-tools/system-tests/intl-setlocale-1-prg
+/gettext-tools/system-tests/intl-setlocale-1-prg.exe
+/gettext-tools/system-tests/intl-setlocale-2-prg
+/gettext-tools/system-tests/intl-setlocale-2-prg.exe
+/gettext-tools/system-tests/intl-thread-1-prg
+/gettext-tools/system-tests/intl-thread-1-prg.exe
+/gettext-tools/system-tests/intl-thread-2-prg
+/gettext-tools/system-tests/intl-thread-2-prg.exe
+/gettext-tools/system-tests/intl-thread-3-prg
+/gettext-tools/system-tests/intl-thread-3-prg.exe
+/gettext-tools/system-tests/testlocale
+/gettext-tools/system-tests/testlocale.exe
 /gettext-tools/tests/cake
 /gettext-tools/tests/cake.exe
 /gettext-tools/tests/fc3
@@ -706,6 +736,8 @@ core
 # Logs generated by Automake:
 /gettext-runtime/tests/*.log
 /gettext-runtime/tests/*.trs
+/gettext-tools/system-tests/*.log
+/gettext-tools/system-tests/*.trs
 /gettext-tools/tests/*.log
 /gettext-tools/tests/*.trs
 # Other.
index 5dfa3362a36957dad3a44fa4565c8e4d91b39de9..4f3e73f68b0fab991711aca10640e25f70ab7355 100644 (file)
@@ -19,7 +19,7 @@
 AUTOMAKE_OPTIONS = 1.5 gnu no-dependencies
 ACLOCAL_AMFLAGS = -I m4 -I ../gettext-runtime/m4 -I ../m4 -I gnulib-m4 -I libgrep/gnulib-m4 -I libgettextpo/gnulib-m4
 
-SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests gnulib-tests examples its
+SUBDIRS = doc intl gnulib-lib libgrep src libgettextpo po projects styles misc man m4 tests system-tests gnulib-tests examples its
 
 EXTRA_DIST = misc/DISCLAIM
 MOSTLYCLEANFILES = core *.stackdump
index 62a23dcff9caa0d8288ad2578aa84cf30ca4e045..b366f3dbf0692a9c2691eee13f9ece471799b87c 100644 (file)
@@ -488,6 +488,10 @@ if test "$CXX" = no; then
 fi
 AC_SUBST([TESTLIBASPRINTF])
 
+dnl Check whether to execute tests of the system (vendor-provided) libintl API.
+dnl We execute these tests if and only if we don't install our own libintl.
+AM_CONDITIONAL([TEST_SYSTEM_LIBINTL], [test $USE_INCLUDED_LIBINTL = no])
+
 dnl Generate the version information file in the intl/ directory.
 test -d intl || mkdir intl
 echo "GNU gettext library from gettext-$VERSION" > intl/VERSION
@@ -538,9 +542,10 @@ AC_CONFIG_FILES([man/x-to-1])
 AC_CONFIG_FILES([m4/Makefile])
 
 AC_CONFIG_FILES([tests/Makefile])
-
 AC_CONFIG_FILES([tests/init-env])
 
+AC_CONFIG_FILES([system-tests/Makefile])
+
 AC_CONFIG_FILES([gnulib-tests/Makefile])
 
 AC_OUTPUT
diff --git a/gettext-tools/system-tests/Makefile.am b/gettext-tools/system-tests/Makefile.am
new file mode 100644 (file)
index 0000000..4c15ec2
--- /dev/null
@@ -0,0 +1,105 @@
+## Makefile for the gettext-tools/system-tests subdirectory of GNU gettext
+## Copyright (C) 1995-2018 Free Software Foundation, 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 3 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, see <https://www.gnu.org/licenses/>.
+
+## Process this file with automake to produce Makefile.in.
+
+AUTOMAKE_OPTIONS = 1.11 gnits no-dependencies color-tests
+EXTRA_DIST =
+MOSTLYCLEANFILES = core *.stackdump
+
+EXTRA_DIST += README run-test
+
+# For debugging memory leaks and memory allocation bugs.
+# You should build with --disable-shared when using valgrind.
+CHECKER =
+#CHECKER = valgrind --tool=memcheck --num-callers=20 --leak-check=yes --leak-resolution=high --show-reachable=yes
+#CHECKER = valgrind --tool=massif --format=html --depth=10 --stacks=no
+
+TESTS_ENVIRONMENT = top_srcdir=$(top_srcdir) \
+                   abs_srcdir=$(abs_srcdir) \
+                   abs_top_srcdir=$(abs_top_srcdir) \
+                   GETTEXT="$(CHECKER) tstgettext" \
+                   NGETTEXT="$(CHECKER) tstngettext" \
+                   XGETTEXT="$(CHECKER) xgettext" \
+                   MSGATTRIB="$(CHECKER) msgattrib" \
+                   MSGCAT="$(CHECKER) msgcat" \
+                   MSGCMP="$(CHECKER) msgcmp" \
+                   MSGCOMM="$(CHECKER) msgcomm" \
+                   MSGCONV="$(CHECKER) msgconv" \
+                   MSGEN="$(CHECKER) msgen" \
+                   MSGEXEC="$(CHECKER) msgexec" \
+                   MSGFILTER="$(CHECKER) msgfilter" \
+                   MSGFMT="$(CHECKER) msgfmt" \
+                   MSGGREP="$(CHECKER) msggrep" \
+                   MSGINIT="$(CHECKER) msginit" \
+                   MSGMERGE="$(CHECKER) msgmerge" \
+                   MSGUNFMT="$(CHECKER) msgunfmt" \
+                   MSGUNIQ="$(CHECKER) msguniq" \
+                   RECODE="$(CHECKER) recode" \
+                   CONFIG_SHELL='$(SHELL)'
+
+LOG_COMPILER = $(SHELL) $(srcdir)/run-test
+
+# It is important that the gnulib-generated *.h files are not visible here,
+# except for config.h.
+AM_CPPFLAGS = -I..
+
+# The USE_SYSTEM_LIBINTL flag distinguishes a compilation in the system-tests/
+# directory from a compilation in the tests/ directory.
+DEFS = -DUSE_SYSTEM_LIBINTL @DEFS@
+
+if TEST_SYSTEM_LIBINTL
+
+TESTS = intl-1 intl-2 intl-3 intl-4 intl-5 \
+       intl-setlocale-1 intl-setlocale-2 \
+       intl-thread-1 intl-thread-2 intl-thread-3 \
+       format-c-3 format-c-4 format-c-5 plural-1
+.PHONY: $(TESTS)
+
+# Auxiliary programs used by the tests.
+check_PROGRAMS = testlocale intl-1-prg intl-3-prg intl-4-prg intl-5-prg intl-setlocale-1-prg intl-setlocale-2-prg intl-thread-1-prg intl-thread-2-prg intl-thread-3-prg cake fc3 fc4 fc5
+testlocale_SOURCES = testlocale.c
+intl_1_prg_SOURCES = intl-1-prg.c
+intl_3_prg_SOURCES = intl-3-prg.c
+intl_4_prg_SOURCES = intl-4-prg.c
+intl_5_prg_SOURCES = intl-5-prg.c
+intl_setlocale_1_prg_SOURCES = intl-setlocale-1-prg.c
+intl_setlocale_2_prg_SOURCES = intl-setlocale-2-prg.c
+intl_thread_1_prg_SOURCES = intl-thread-1-prg.c
+intl_thread_1_prg_CFLAGS = $(intl_thread_1_prg_CFLAGS_@HAVE_NEWLOCALE@)
+intl_thread_1_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
+intl_thread_1_prg_LDADD = $(LDADD) $(intl_thread_1_prg_LDADD_@HAVE_NEWLOCALE@)
+intl_thread_1_prg_LDADD_1 = -lpthread
+intl_thread_2_prg_SOURCES = intl-thread-2-prg.c
+intl_thread_2_prg_CFLAGS = $(intl_thread_2_prg_CFLAGS_@HAVE_NEWLOCALE@)
+intl_thread_2_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
+intl_thread_2_prg_LDADD = $(LDADD) $(intl_thread_2_prg_LDADD_@HAVE_NEWLOCALE@)
+intl_thread_2_prg_LDADD_1 = -lpthread
+intl_thread_3_prg_SOURCES = intl-thread-3-prg.c
+intl_thread_3_prg_CFLAGS = $(intl_thread_3_prg_CFLAGS_@HAVE_NEWLOCALE@)
+intl_thread_3_prg_CFLAGS_1 = -DUSE_POSIX_THREADS
+intl_thread_3_prg_LDADD = $(LDADD) $(intl_thread_3_prg_LDADD_@HAVE_NEWLOCALE@)
+intl_thread_3_prg_LDADD_1 = -lpthread
+cake_SOURCES = plural-1-prg.c
+fc3_SOURCES = format-c-3-prg.c
+fc4_SOURCES = format-c-4-prg.c
+fc5_SOURCES = format-c-5-prg.c
+
+endif
+
+# Clean up after Solaris cc.
+clean-local:
+       rm -rf SunWS_cache
diff --git a/gettext-tools/system-tests/README b/gettext-tools/system-tests/README
new file mode 100644 (file)
index 0000000..c26faaa
--- /dev/null
@@ -0,0 +1,5 @@
+This directory contains tests of the system (vendor-provided) libintl
+or libc.
+
+Whereas the gettext-runtime/intl/ directory is tested as part of
+gettext-tools/tests/.
diff --git a/gettext-tools/system-tests/format-c-3-prg.c b/gettext-tools/system-tests/format-c-3-prg.c
new file mode 100644 (file)
index 0000000..681d739
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/format-c-3-prg.c"
diff --git a/gettext-tools/system-tests/format-c-4-prg.c b/gettext-tools/system-tests/format-c-4-prg.c
new file mode 100644 (file)
index 0000000..b2e7d78
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/format-c-4-prg.c"
diff --git a/gettext-tools/system-tests/format-c-5-prg.c b/gettext-tools/system-tests/format-c-5-prg.c
new file mode 100644 (file)
index 0000000..e7c3ff3
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/format-c-5-prg.c"
diff --git a/gettext-tools/system-tests/intl-1-prg.c b/gettext-tools/system-tests/intl-1-prg.c
new file mode 100644 (file)
index 0000000..4c599c4
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-1-prg.c"
diff --git a/gettext-tools/system-tests/intl-3-prg.c b/gettext-tools/system-tests/intl-3-prg.c
new file mode 100644 (file)
index 0000000..db8d7f8
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-3-prg.c"
diff --git a/gettext-tools/system-tests/intl-4-prg.c b/gettext-tools/system-tests/intl-4-prg.c
new file mode 100644 (file)
index 0000000..b2110a5
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-4-prg.c"
diff --git a/gettext-tools/system-tests/intl-5-prg.c b/gettext-tools/system-tests/intl-5-prg.c
new file mode 100644 (file)
index 0000000..545d627
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-5-prg.c"
diff --git a/gettext-tools/system-tests/intl-setlocale-1-prg.c b/gettext-tools/system-tests/intl-setlocale-1-prg.c
new file mode 100644 (file)
index 0000000..43400e3
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-setlocale-1-prg.c"
diff --git a/gettext-tools/system-tests/intl-setlocale-2-prg.c b/gettext-tools/system-tests/intl-setlocale-2-prg.c
new file mode 100644 (file)
index 0000000..e1250da
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-setlocale-2-prg.c"
diff --git a/gettext-tools/system-tests/intl-thread-1-prg.c b/gettext-tools/system-tests/intl-thread-1-prg.c
new file mode 100644 (file)
index 0000000..f44c7d7
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-thread-1-prg.c"
diff --git a/gettext-tools/system-tests/intl-thread-2-prg.c b/gettext-tools/system-tests/intl-thread-2-prg.c
new file mode 100644 (file)
index 0000000..8b6e8ee
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-thread-2-prg.c"
diff --git a/gettext-tools/system-tests/intl-thread-3-prg.c b/gettext-tools/system-tests/intl-thread-3-prg.c
new file mode 100644 (file)
index 0000000..30eb56c
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/intl-thread-3-prg.c"
diff --git a/gettext-tools/system-tests/plural-1-prg.c b/gettext-tools/system-tests/plural-1-prg.c
new file mode 100644 (file)
index 0000000..8a8f2fc
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/plural-1-prg.c"
diff --git a/gettext-tools/system-tests/run-test b/gettext-tools/system-tests/run-test
new file mode 100755 (executable)
index 0000000..1431271
--- /dev/null
@@ -0,0 +1,12 @@
+#!/bin/sh
+# Run a test whose source and data files are located in the ../tests/ directory.
+
+srcdir="$srcdir/../tests"
+abs_srcdir="$abs_srcdir/../tests"
+USE_SYSTEM_LIBINTL=yes
+export srcdir abs_srcdir USE_SYSTEM_LIBINTL
+
+testname=`echo "$1" | sed 's,^.*/,,'`
+shift
+
+exec /bin/sh "$srcdir/$testname" "$@"
diff --git a/gettext-tools/system-tests/testlocale.c b/gettext-tools/system-tests/testlocale.c
new file mode 100644 (file)
index 0000000..8446a93
--- /dev/null
@@ -0,0 +1 @@
+#include "../tests/testlocale.c"
index 0509e1fce6337314de9f1362f5cb82b25e74c60c..de59476abad29c67c61cb546f1a7a2a785400cea 100755 (executable)
@@ -23,20 +23,47 @@ msgstr "Vater von %<PRId8> Kindern"
 EOF
 
 test -d fc3-dir || mkdir fc3-dir
-test -d fc3-dir/de || mkdir fc3-dir/de
-test -d fc3-dir/de/LC_MESSAGES || mkdir fc3-dir/de/LC_MESSAGES
+test -d fc3-dir/fr || mkdir fc3-dir/fr
+test -d fc3-dir/fr/LC_MESSAGES || mkdir fc3-dir/fr/LC_MESSAGES
 
 : ${MSGFMT=msgfmt}
-${MSGFMT} -o fc3-dir/de/LC_MESSAGES/fc3.mo fc3-de.po
+${MSGFMT} -o fc3-dir/fr/LC_MESSAGES/fc3.mo fc3-de.po
 
 : ${MSGUNFMT=msgunfmt}
-${MSGUNFMT} -o fc3-de.po.tmp fc3-dir/de/LC_MESSAGES/fc3.mo || Exit 1
+${MSGUNFMT} -o fc3-de.po.tmp fc3-dir/fr/LC_MESSAGES/fc3.mo || Exit 1
 LC_ALL=C tr -d '\r' < fc3-de.po.tmp > fc3-de.po.un || Exit 1
 
 : ${DIFF=diff}
 ${DIFF} fc3-de.po fc3-de.po.un || Exit 1
 
-LANGUAGE= ../fc3 de_DE
-result=$?
+if test -z "$USE_SYSTEM_LIBINTL"; then
+  # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+  # the test on all platforms.
 
-exit $result
+  LANGUAGE= ../fc3 fr_FR || Exit 1
+
+else
+  # In the system-tests/ dir: Don't use a fake setlocale.
+
+  : ${LOCALE_FR=fr_FR}
+  : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+  if test $LOCALE_FR != none; then
+    prepare_locale_ fc3-dir/fr fc3-dir/$LOCALE_FR
+    LANGUAGE= ../fc3 $LOCALE_FR || Exit 1
+  fi
+  if test $LOCALE_FR_UTF8 != none; then
+    prepare_locale_ fc3-dir/fr fc3-dir/$LOCALE_FR_UTF8
+    LANGUAGE= ../fc3 $LOCALE_FR_UTF8 || Exit 1
+  fi
+  if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
+    if test -f /usr/bin/localedef; then
+      echo "Skipping test: no french locale is installed"
+    else
+      echo "Skipping test: no french locale is supported"
+    fi
+    Exit 77
+  fi
+
+fi
+
+Exit 0
index 7bee685f9c037ef3763f3ebac134e19be9e4f305..813dd154a28879af8ece9872a429769e77a186f7 100644 (file)
 #ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
 #endif
-#include "xsetenv.h"
 
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 /* Disable the override of setlocale that libgnuintl.h activates on MacOS X
    and Windows.  This test relies on the fake setlocale function in
index 3ab9ddcb88654d9d666e6153615bd697fed85951..6f76eb6ae0a94de970431e460039d8ded8fc6349 100755 (executable)
@@ -27,20 +27,47 @@ msgstr[1] "Vater von %<PRId8> Kindern"
 EOF
 
 test -d fc4-dir || mkdir fc4-dir
-test -d fc4-dir/de || mkdir fc4-dir/de
-test -d fc4-dir/de/LC_MESSAGES || mkdir fc4-dir/de/LC_MESSAGES
+test -d fc4-dir/fr || mkdir fc4-dir/fr
+test -d fc4-dir/fr/LC_MESSAGES || mkdir fc4-dir/fr/LC_MESSAGES
 
 : ${MSGFMT=msgfmt}
-${MSGFMT} -o fc4-dir/de/LC_MESSAGES/fc4.mo fc4-de.po
+${MSGFMT} -o fc4-dir/fr/LC_MESSAGES/fc4.mo fc4-de.po
 
 : ${MSGUNFMT=msgunfmt}
-${MSGUNFMT} -o fc4-de.po.tmp fc4-dir/de/LC_MESSAGES/fc4.mo || Exit 1
+${MSGUNFMT} -o fc4-de.po.tmp fc4-dir/fr/LC_MESSAGES/fc4.mo || Exit 1
 LC_ALL=C tr -d '\r' < fc4-de.po.tmp > fc4-de.po.un || Exit 1
 
 : ${DIFF=diff}
 ${DIFF} fc4-de.po fc4-de.po.un || Exit 1
 
-LANGUAGE= ../fc4 de_DE
-result=$?
+if test -z "$USE_SYSTEM_LIBINTL"; then
+  # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+  # the test on all platforms.
 
-exit $result
+  LANGUAGE= ../fc4 fr_FR || Exit 1
+
+else
+  # In the system-tests/ dir: Don't use a fake setlocale.
+
+  : ${LOCALE_FR=fr_FR}
+  : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+  if test $LOCALE_FR != none; then
+    prepare_locale_ fc4-dir/fr fc4-dir/$LOCALE_FR
+    LANGUAGE= ../fc4 $LOCALE_FR || Exit 1
+  fi
+  if test $LOCALE_FR_UTF8 != none; then
+    prepare_locale_ fc4-dir/fr fc4-dir/$LOCALE_FR_UTF8
+    LANGUAGE= ../fc4 $LOCALE_FR_UTF8 || Exit 1
+  fi
+  if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
+    if test -f /usr/bin/localedef; then
+      echo "Skipping test: no french locale is installed"
+    else
+      echo "Skipping test: no french locale is supported"
+    fi
+    Exit 77
+  fi
+
+fi
+
+Exit 0
index b3e05bf2fec3db68a8f945436c0481cb99145893..d405f94139d1d604e49bf299d68c30cd4440a770 100644 (file)
 #ifdef HAVE_INTTYPES_H
 # include <inttypes.h>
 #endif
-#include "xsetenv.h"
 
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 /* Disable the override of setlocale that libgnuintl.h activates on MacOS X
    and Windows.  This test relies on the fake setlocale function in
index 919296758669d61debf0e49fb9d7a4588b1862b8..1528b17a409a75409ec14a31061f25179eb4242a 100755 (executable)
@@ -36,17 +36,53 @@ LC_ALL=C tr -d '\r' < fa.po.tmp > fa.po.un || Exit 1
 : ${DIFF=diff}
 ${DIFF} fa.po fa.po.un || Exit 1
 
-LANGUAGE= ../fc5 fa_IR
-case $? in
-  0) ;;
-  77)
+if test -z "$USE_SYSTEM_LIBINTL"; then
+  # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+  # the test on all platforms.
+
+  LANGUAGE= ../fc5 fa_IR
+  case $? in
+    0) ;;
+    77)
+      if test -f /usr/bin/localedef; then
+        echo "Skipping test: locale fa_IR not installed"
+      else
+        echo "Skipping test: locale fa_IR not supported"
+      fi
+      Exit 77;;
+    *) Exit 1;;
+  esac
+
+else
+  # In the system-tests/ dir: Don't use a fake setlocale.
+
+  skipped=true
+
+  prepare_locale_ fa fa_IR
+  LANGUAGE= ../fc5 fa_IR
+  case $? in
+    0) skipped=false ;;
+    77) ;;
+    *) Exit 1;;
+  esac
+
+  prepare_locale_ fa fa_IR.UTF-8
+  LANGUAGE= ../fc5 fa_IR.UTF-8
+  case $? in
+    0) skipped=false ;;
+    77) ;;
+    *) Exit 1;;
+  esac
+
+  if $skipped; then
     if test -f /usr/bin/localedef; then
-      echo "Skipping test: locale fa_IR not installed"
+      echo "Skipping test: no Farsi locale is installed"
     else
-      echo "Skipping test: locale fa_IR not supported"
+      echo "Skipping test: no Farsi locale is supported"
     fi
-    Exit 77;;
-  *) Exit 1;;
-esac
+    Exit 77
+  fi
+
+fi
 
 Exit 0
index a453d6bab3d604fa94cc88dbf8335e6c0d7e5ed9..bd0be6c28f0fc6f6b3e9de885656cb9d759934e8 100644 (file)
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include "xsetenv.h"
 
 /* For %Id to work, we need the real setlocale(), not the fake one. */
-#if !(__GLIBC__ >= 2 && !defined __UCLIBC__)
+#if !USE_SYSTEM_LIBINTL && !(__GLIBC__ >= 2 && !defined __UCLIBC__)
 # include "setlocale.c"
 #endif
 
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 #define _(string) gettext (string)
 
index 40ee41f38b28bcab6fb712aec14a033417643a99..cc981491b0639ad8fd47cbb755f1f0a4191de1f8 100644 (file)
@@ -1,5 +1,7 @@
-test -f "./init-env" \
-  && . "./init-env"
+# This file extends the init.sh (provided by gnulib).
+
+# Set environment variables for the tests.
+. ../tests/init-env
 
 prepare_locale_ ()
 {
index fc0a896799de4f89998f90dbc2992a5ec9b5a092..d31455aad637eb57fc5c49f2400a4530cd535cbd 100644 (file)
 #include <locale.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "xsetenv.h"
 
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 int
 main (int argc, char *argv[])
index 19c76031914d40ae3054bc27d579c1edaae51f4f..c3ad2a1a401f9dd633ac14cf091dd2b3955dbf99 100644 (file)
 #include <locale.h>
 #include <stdlib.h>
 #include <stdio.h>
-#include "xsetenv.h"
 
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 int
 main (int argc, char *argv[])
index e351bd96b0ab889d1535fb5c536c586ec0f0f9ac..df4c6fea89ffac27cd2d1ef1acf3041672333e7e 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include "xsetenv.h"
 
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 int
 main (int argc, char *argv[])
index 8c7c0b304f500c57aa8b4ea09eb7f5c21f0309a3..4794af93482f6298156239b1a89c2ba979f5d8d6 100644 (file)
 # include <sys/resource.h>
 #endif
 
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 int
 main ()
index 0463d6c3ce1d6411c46619a3ac81fe7c0fc549b1..6954099f36638ed689232dffce169e595519d612 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 #define N_(string) string
 
index e1f9a70c6c05a7a137b62ebb79a723f8bd35f082..93a1b1bff5f1866b2167bb306c859b175ca75756 100644 (file)
 #include <stdio.h>
 #include <string.h>
 
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 int
 main (void)
index 77d64266f4e11d80f7ebcc12bb39a7eaefb46d24..fca7163f055c60c63efa15caef8014be72015582 100644 (file)
 
 #include <pthread.h>
 
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 /* Name of locale to use in thread1.  */
 const char *locale_name_1;
index 49c3c20d8c7393455902bfcb67651ab6d27fb0db..5edcbe1c0a2f43819aa1c22f5a90899d746093dc 100644 (file)
 
 #include <pthread.h>
 
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 /* Name of locale to use in thread1.  */
 const char *locale_name_1;
index c9ff0bfc737e229662ff69defcf7290aa23c9952..3fbccbf7df630cecf21317dc9f7fb770bafe57bd 100644 (file)
 
 #include <pthread.h>
 
+#if USE_SYSTEM_LIBINTL
+# include <libintl.h>
+#else
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 /* Name of locale to use in thread1.  */
 const char *locale_name_1;
index 66dd10b761b58029be8506226b023e2470acc1f5..f5040dc7a50e122aeaf1c85753155da2ca53a26d 100755 (executable)
@@ -48,18 +48,50 @@ sed 1,2d < plural-1-fr.po > plural-1-fr.po.strip
 : ${DIFF=diff}
 ${DIFF} plural-1-fr.po.strip plural-1-fr.po.un || Exit 1
 
-: ${DIFF=diff}
-echo 'un morceau de gateau' > plural-1-cake.ok
-LANGUAGE= ../cake fr 1 > plural-1-cake.tmp || Exit 1
-LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
-${DIFF} plural-1-cake.ok cake.out || Exit 1
-echo '2 morceaux de gateau' > plural-1-cake.ok
-LANGUAGE= ../cake fr 2 > plural-1-cake.tmp || Exit 1
-LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
-${DIFF} plural-1-cake.ok cake.out || Exit 1
-echo '10 morceaux de gateau' > plural-1-cake.ok
-LANGUAGE= ../cake fr 10 > plural-1-cake.tmp || Exit 1
-LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
-${DIFF} plural-1-cake.ok cake.out || Exit 1
+func_do_test ()
+{
+  echo 'un morceau de gateau' > plural-1-cake.ok
+  LANGUAGE= ../cake "$1" 1 > plural-1-cake.tmp || Exit 1
+  LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
+  ${DIFF} plural-1-cake.ok cake.out || Exit 1
+  echo '2 morceaux de gateau' > plural-1-cake.ok
+  LANGUAGE= ../cake "$1" 2 > plural-1-cake.tmp || Exit 1
+  LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
+  ${DIFF} plural-1-cake.ok cake.out || Exit 1
+  echo '10 morceaux de gateau' > plural-1-cake.ok
+  LANGUAGE= ../cake "$1" 10 > plural-1-cake.tmp || Exit 1
+  LC_ALL=C tr -d '\r' < plural-1-cake.tmp > cake.out || Exit 1
+  ${DIFF} plural-1-cake.ok cake.out || Exit 1
+}
+
+if test -z "$USE_SYSTEM_LIBINTL"; then
+  # In the tests/ dir: Rely on a fake setlocale, so that we can exercise
+  # the test on all platforms.
+
+  func_do_test fr
+
+else
+  # In the system-tests/ dir: Don't use a fake setlocale.
+
+  : ${LOCALE_FR=fr_FR}
+  : ${LOCALE_FR_UTF8=fr_FR.UTF-8}
+  if test $LOCALE_FR != none; then
+    prepare_locale_ plural-1-dir/fr plural-1-dir/$LOCALE_FR
+    func_do_test $LOCALE_FR
+  fi
+  if test $LOCALE_FR_UTF8 != none; then
+    prepare_locale_ plural-1-dir/fr plural-1-dir/$LOCALE_FR_UTF8
+    func_do_test $LOCALE_FR_UTF8
+  fi
+  if test $LOCALE_FR = none && test $LOCALE_FR_UTF8 = none; then
+    if test -f /usr/bin/localedef; then
+      echo "Skipping test: no french locale is installed"
+    else
+      echo "Skipping test: no french locale is supported"
+    fi
+    Exit 77
+  fi
+
+fi
 
 Exit 0
index 7abea8852a1486f5dddf9f98670cf8fd2fe634a6..f2bbfee2f0d509514df60f252f4b81facaf65de4 100644 (file)
 #include <stdlib.h>
 #include <stdio.h>
 #include <locale.h>
-#include "xsetenv.h"
 
+#if USE_SYSTEM_LIBINTL
+# define xsetenv setenv
+# include <libintl.h>
+#else
+# include "xsetenv.h"
 /* Make sure we use the included libintl, not the system's one. */
-#undef _LIBINTL_H
-#include "libgnuintl.h"
+# undef _LIBINTL_H
+# include "libgnuintl.h"
+#endif
 
 /* Disable the override of setlocale that libgnuintl.h activates on MacOS X
    and Windows.  This test relies on the fake setlocale function in