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