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 referring to
      5 # the same catalog file but with different encodings.
      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.ISO-8859-1 and
     17 # de_DE.UTF-8 locale installed.
     18 LC_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 }
     26 LC_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 
     35 tmpfiles="$tmpfiles de_DE"
     36 test -d de_DE || mkdir de_DE
     37 test -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 
     42 tmpfiles="$tmpfiles gt-7.out"
     43 ./gettext-7-prg > gt-7.out
     44 case $? in
     45   0) ;;
     46   77)
     47     echo "Skipping test: not a glibc 2.3 system"
     48     rm -fr $tmpfiles; exit 77
     49     ;;
     50 esac
     51 
     52 rm -fr $tmpfiles
     53 
     54 exit 0
     55