xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/tests/gettext-7 (revision fdd524d4ccd2bb0c6f67401e938dabf773eb0372)
1#! /bin/sh
2
3# Test that on glibc systems, gettext() in multithreaded applications works
4# correctly if different threads operate in different locales referring to
5# the same catalog file but with different encodings.
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.ISO-8859-1 and
17# de_DE.UTF-8 locale installed.
18LC_ALL=de_DE.ISO-8859-1 ./testlocale || {
19  if test -f /usr/bin/localedef; then
20    echo "Skipping test: locale de_DE.ISO-8859-1 not installed"
21  else
22    echo "Skipping test: locale de_DE.ISO-8859-1 not supported"
23  fi
24  exit 77
25}
26LC_ALL=de_DE.UTF-8 ./testlocale || {
27  if test -f /usr/bin/localedef; then
28    echo "Skipping test: locale de_DE.UTF-8 not installed"
29  else
30    echo "Skipping test: locale de_DE.UTF-8 not supported"
31  fi
32  exit 77
33}
34
35tmpfiles="$tmpfiles de_DE"
36test -d de_DE || mkdir de_DE
37test -d de_DE/LC_MESSAGES || mkdir de_DE/LC_MESSAGES
38
39: ${MSGFMT=msgfmt}
40${MSGFMT} -o de_DE/LC_MESSAGES/tstthread.mo ${top_srcdir}/tests/gettext-7.po
41
42tmpfiles="$tmpfiles gt-7.out"
43./gettext-7-prg > gt-7.out
44case $? in
45  0) ;;
46  77)
47    echo "Skipping test: not a glibc 2.3 system"
48    rm -fr $tmpfiles; exit 77
49    ;;
50esac
51
52rm -fr $tmpfiles
53
54exit 0
55