Home | History | Annotate | Line # | Download | only in tests
      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 
      7 tmpfiles=""
      8 trap 'rm -fr $tmpfiles' 1 2 3 15
      9 
     10 # This test works only on glibc systems.
     11 grep '@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.
     17 LC_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 }
     25 LC_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 
     34 tmpfiles="$tmpfiles de_DE fr_FR"
     35 test -d de_DE || mkdir de_DE
     36 test -d de_DE/LC_MESSAGES || mkdir de_DE/LC_MESSAGES
     37 test -d fr_FR || mkdir fr_FR
     38 test -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 
     44 tmpfiles="$tmpfiles gt-6.ok"
     45 cat <<EOF > gt-6.ok
     46 Schnheit
     47 beaut
     48 Schnheit
     49 beaut
     50 EOF
     51 
     52 tmpfiles="$tmpfiles gt-6.out"
     53 ./gettext-6-prg > gt-6.out
     54 case $? in
     55   0) ;;
     56   77)
     57     echo "Skipping test: not a glibc 2.3 system"
     58     rm -fr $tmpfiles; exit 77
     59     ;;
     60 esac
     61 
     62 : ${DIFF=diff}
     63 ${DIFF} gt-6.ok gt-6.out || exit 1
     64 
     65 rm -fr $tmpfiles
     66 
     67 exit 0
     68