summaryrefslogtreecommitdiffstats
path: root/gettext-tools/tests/gettext-7
blob: 0970df491c0af7ccb176d66744819d66472224d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#! /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 referring to
# the same catalog file but with different encodings.

tmpfiles=""
trap 'rm -fr $tmpfiles' 1 2 3 15

# 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.ISO-8859-1 and
# de_DE.UTF-8 locale installed.
missing_locale=`./gettext-7-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

tmpfiles="$tmpfiles gt-7"
test -d gt-7 || mkdir gt-7
test -d gt-7/de_DE || mkdir gt-7/de_DE
test -d gt-7/de_DE/LC_MESSAGES || mkdir gt-7/de_DE/LC_MESSAGES

: ${MSGFMT=msgfmt}
${MSGFMT} -o gt-7/de_DE/LC_MESSAGES/tstthread.mo ../${srcdir}/gettext-7.po

tmpfiles="$tmpfiles gt-7.out"
../gettext-7-prg > gt-7.out
case $? in
  0) ;;
  77)
    echo "Skipping test: not a glibc >= 2.3 or MacOS X >= 10.5 system"
    rm -fr $tmpfiles; exit 77
    ;;
  *)
    exit 1
    ;;
esac

rm -fr $tmpfiles

exit 0