tst-gettext.sh 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # Test of gettext functions.
  3. # Copyright (C) 2000-2026 Free Software Foundation, Inc.
  4. # This file is part of the GNU C Library.
  5. # The GNU C Library is free software; you can redistribute it and/or
  6. # modify it under the terms of the GNU Lesser General Public
  7. # License as published by the Free Software Foundation; either
  8. # version 2.1 of the License, or (at your option) any later version.
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # Lesser General Public License for more details.
  13. # You should have received a copy of the GNU Lesser General Public
  14. # License along with the GNU C Library; if not, see
  15. # <https://www.gnu.org/licenses/>.
  16. set -e
  17. common_objpfx=$1
  18. test_program_prefix_before_env=$2
  19. run_program_env=$3
  20. test_program_prefix_after_env=$4
  21. objpfx=$5
  22. malloc_trace=$6
  23. # Generate the test data.
  24. # Create the locale directories.
  25. mkdir -p ${objpfx}localedir/existing-locale/LC_MESSAGES
  26. for f in ADDRESS COLLATE CTYPE IDENTIFICATION MEASUREMENT MONETARY NAME NUMERIC PAPER TELEPHONE TIME; do
  27. cp -f ${common_objpfx}localedata/de_DE.UTF-8/LC_$f \
  28. ${objpfx}localedir/existing-locale
  29. done
  30. cp -f ${common_objpfx}localedata/de_DE.UTF-8/LC_MESSAGES/SYS_LC_MESSAGES \
  31. ${objpfx}localedir/existing-locale/LC_MESSAGES
  32. # Create the domain directories.
  33. mkdir -p ${objpfx}domaindir/existing-locale/LC_MESSAGES
  34. mkdir -p ${objpfx}domaindir/existing-locale/LC_TIME
  35. # Populate them.
  36. msgfmt -o ${objpfx}domaindir/existing-locale/LC_MESSAGES/existing-domain.mo \
  37. -f ${objpfx}tst-gettext-de.po
  38. msgfmt -o ${objpfx}domaindir/existing-locale/LC_TIME/existing-time-domain.mo \
  39. -f ${objpfx}tst-gettext-de.po
  40. # Now run the test.
  41. ${test_program_prefix_before_env} \
  42. ${run_program_env} \
  43. MALLOC_TRACE=$malloc_trace \
  44. LD_PRELOAD=${common_objpfx}malloc/libc_malloc_debug.so \
  45. LOCPATH=${objpfx}localedir:${common_objpfx}localedata \
  46. ${test_program_prefix_after_env} \
  47. ${objpfx}tst-gettext > ${objpfx}tst-gettext.out ${objpfx}domaindir
  48. exit $?