xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/gettext-6 (revision b83ebeba7f767758d2778bb0f9d7a76534253621)
1#! /bin/sh
2
3# Test that on glibc systems, gettext() in multithreaded applications works
4# correctly if different threads operate in different locales with the same
5# encoding.
6
7tmpfiles=""
8trap 'rm -fr $tmpfiles' 1 2 3 15
9
10# This test works only on glibc systems.
11grep '@GLIBC2@.*yes' ../config.status >/dev/null || {
12  echo "Skipping test: not a glibc system"
13  exit 77
14}
15
16# This test works only on systems that have a de_DE and fr_FR locale installed.
17LC_ALL=de_DE ./testlocale || {
18  if test -f /usr/bin/localedef; then
19    echo "Skipping test: locale de_DE not installed"
20  else
21    echo "Skipping test: locale de_DE not supported"
22  fi
23  exit 77
24}
25LC_ALL=fr_FR ./testlocale || {
26  if test -f /usr/bin/localedef; then
27    echo "Skipping test: locale fr_FR not installed"
28  else
29    echo "Skipping test: locale fr_FR not supported"
30  fi
31  exit 77
32}
33
34tmpfiles="$tmpfiles de_DE fr_FR"
35test -d de_DE || mkdir de_DE
36test -d de_DE/LC_MESSAGES || mkdir de_DE/LC_MESSAGES
37test -d fr_FR || mkdir fr_FR
38test -d fr_FR/LC_MESSAGES || mkdir fr_FR/LC_MESSAGES
39
40: ${MSGFMT=msgfmt}
41${MSGFMT} -o de_DE/LC_MESSAGES/tstthread.mo ${top_srcdir}/tests/gettext-6-1.po
42${MSGFMT} -o fr_FR/LC_MESSAGES/tstthread.mo ${top_srcdir}/tests/gettext-6-2.po
43
44tmpfiles="$tmpfiles gt-6.ok"
45cat <<EOF > gt-6.ok
46Sch�nheit
47beaut�
48Sch�nheit
49beaut�
50EOF
51
52tmpfiles="$tmpfiles gt-6.out"
53./gettext-6-prg > gt-6.out
54case $? in
55  0) ;;
56  77)
57    echo "Skipping test: not a glibc 2.3 system"
58    rm -fr $tmpfiles; exit 77
59    ;;
60esac
61
62: ${DIFF=diff}
63${DIFF} gt-6.ok gt-6.out || exit 1
64
65rm -fr $tmpfiles
66
67exit 0
68