summaryrefslogtreecommitdiff
path: root/gettext-tools/tests/gettext-6
diff options
context:
space:
mode:
Diffstat (limited to 'gettext-tools/tests/gettext-6')
-rwxr-xr-xgettext-tools/tests/gettext-661
1 files changed, 61 insertions, 0 deletions
diff --git a/gettext-tools/tests/gettext-6 b/gettext-tools/tests/gettext-6
new file mode 100755
index 0000000..7bc4e01
--- /dev/null
+++ b/gettext-tools/tests/gettext-6
@@ -0,0 +1,61 @@
+#! /bin/sh
+. "${srcdir=.}/init.sh"; path_prepend_ . ../src
+
+# Test that on glibc systems, gettext() in multithreaded applications works
+# correctly if different threads operate in different locales with the same
+# encoding.
+
+# This test works only on glibc and MacOS X systems.
+: ${host_os=unknown}
+: ${GLIBC2=no}
+{ case "$host_os" in
+ *-gnu*) test "$GLIBC2" = yes ;;
+ darwin*) true ;;
+ *) false ;;
+ esac
+} || {
+ echo "Skipping test: not a glibc or Mac OS X system"
+ exit 77
+}
+
+# This test works only on systems that have a de_DE and fr_FR locale installed.
+missing_locale=`../gettext-6-prg 1`
+if test -n "$missing_locale"; then
+ if test -f /usr/bin/localedef; then
+ echo "Skipping test: locale ${missing_locale} not installed"
+ else
+ echo "Skipping test: locale ${missing_locale} not supported"
+ fi
+ exit 77
+fi
+
+test -d gt-6 || mkdir gt-6
+test -d gt-6/de_DE || mkdir gt-6/de_DE
+test -d gt-6/de_DE/LC_MESSAGES || mkdir gt-6/de_DE/LC_MESSAGES
+test -d gt-6/fr_FR || mkdir gt-6/fr_FR
+test -d gt-6/fr_FR/LC_MESSAGES || mkdir gt-6/fr_FR/LC_MESSAGES
+
+: ${MSGFMT=msgfmt}
+${MSGFMT} -o gt-6/de_DE/LC_MESSAGES/tstthread.mo "$abs_srcdir"/gettext-6-1.po
+${MSGFMT} -o gt-6/fr_FR/LC_MESSAGES/tstthread.mo "$abs_srcdir"/gettext-6-2.po
+
+cat <<EOF > gt-6.ok
+Schönheit
+beauté
+Schönheit
+beauté
+EOF
+
+../gettext-6-prg > gt-6.out
+case $? in
+ 0) ;;
+ 77)
+ echo "Skipping test: not a glibc >= 2.3 or MacOS X >= 10.5 system"
+ exit 77
+ ;;
+esac
+
+: ${DIFF=diff}
+${DIFF} gt-6.ok gt-6.out || exit 1
+
+exit 0