Imported Upstream version 0.19.7
[platform/upstream/gettext.git] / gettext-tools / tests / gettext-6
1 #! /bin/sh
2 . "${srcdir=.}/init.sh"; path_prepend_ . ../src
3
4 # Test that on glibc systems, gettext() in multithreaded applications works
5 # correctly if different threads operate in different locales with the same
6 # encoding.
7
8 # This test works only on glibc and MacOS X systems.
9 : ${host_os=unknown}
10 : ${GLIBC2=no}
11 { case "$host_os" in
12     *-gnu*) test "$GLIBC2" = yes ;;
13     darwin*) true ;;
14     *) false ;;
15   esac
16 } || {
17   echo "Skipping test: not a glibc or Mac OS X system"
18   exit 77
19 }
20
21 # This test works only on systems that have a de_DE and fr_FR locale installed.
22 missing_locale=`../gettext-6-prg 1`
23 if test -n "$missing_locale"; then
24   if test -f /usr/bin/localedef; then
25     echo "Skipping test: locale ${missing_locale} not installed"
26   else
27     echo "Skipping test: locale ${missing_locale} not supported"
28   fi
29   exit 77
30 fi
31
32 test -d gt-6 || mkdir gt-6
33 test -d gt-6/de_DE || mkdir gt-6/de_DE
34 test -d gt-6/de_DE/LC_MESSAGES || mkdir gt-6/de_DE/LC_MESSAGES
35 test -d gt-6/fr_FR || mkdir gt-6/fr_FR
36 test -d gt-6/fr_FR/LC_MESSAGES || mkdir gt-6/fr_FR/LC_MESSAGES
37
38 : ${MSGFMT=msgfmt}
39 ${MSGFMT} -o gt-6/de_DE/LC_MESSAGES/tstthread.mo "$abs_srcdir"/gettext-6-1.po
40 ${MSGFMT} -o gt-6/fr_FR/LC_MESSAGES/tstthread.mo "$abs_srcdir"/gettext-6-2.po
41
42 cat <<EOF > gt-6.ok
43 Schönheit
44 beauté
45 Schönheit
46 beauté
47 EOF
48
49 ../gettext-6-prg > gt-6.out
50 case $? in
51   0) ;;
52   77)
53     echo "Skipping test: not a glibc >= 2.3 or MacOS X >= 10.5 system"
54     exit 77
55     ;;
56 esac
57
58 : ${DIFF=diff}
59 ${DIFF} gt-6.ok gt-6.out || exit 1
60
61 exit 0