test-bug-624218-Translation-file-handling 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. #!/bin/sh
  2. set -e
  3. TESTDIR="$(readlink -f "$(dirname "$0")")"
  4. . "$TESTDIR/framework"
  5. setupenvironment
  6. configarchitecture 'i386'
  7. buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'
  8. setupaptarchive --no-update
  9. changetowebserver
  10. rm -rf rootdir/var/lib/apt/lists
  11. translationslisted() {
  12. msgtest 'No download of non-existent locals' "$1"
  13. export LC_ALL=""
  14. testsuccess --nomsg aptget update -o Acquire::Languages=en
  15. testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output
  16. rm -rf rootdir/var/lib/apt/lists
  17. msgtest 'Download of existent locals' "$1"
  18. testsuccess --nomsg aptget update
  19. cp rootdir/tmp/testsuccess.output testsuccess.output
  20. testsuccess grep -q -e 'Translation-en ' testsuccess.output
  21. rm -rf rootdir/var/lib/apt/lists
  22. msgtest 'Download of en in LC_ALL=C' "$1"
  23. export LC_ALL=C
  24. testsuccess --nomsg aptget update
  25. cp rootdir/tmp/testsuccess.output testsuccess.output
  26. testsuccess grep -q -e 'Translation-en ' testsuccess.output
  27. rm -rf rootdir/var/lib/apt/lists
  28. unset LC_ALL
  29. msgtest 'Download of en as forced language' "$1"
  30. testsuccess --nomsg aptget update -o Acquire::Languages=en
  31. cp rootdir/tmp/testsuccess.output testsuccess.output
  32. testsuccess grep -q -e 'Translation-en ' testsuccess.output
  33. rm -rf rootdir/var/lib/apt/lists
  34. msgtest 'Download of nothing else in forced language' "$1"
  35. testsuccess --nomsg aptget update -o Acquire::Languages=en
  36. testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testsuccess.output
  37. rm -rf rootdir/var/lib/apt/lists
  38. msgtest 'Download no Translation- if forced language is non-existent' "$1"
  39. testsuccess --nomsg aptget update -o Acquire::Languages=ast_DE
  40. testfailure grep -q -e 'Translation-' rootdir/tmp/testsuccess.output
  41. rm -rf rootdir/var/lib/apt/lists
  42. msgtest 'Download of nothing if none is forced' "$1"
  43. testsuccess --nomsg aptget update -o Acquire::Languages=none
  44. testfailure grep -q -e 'Translation' rootdir/tmp/testsuccess.output
  45. rm -rf rootdir/var/lib/apt/lists
  46. }
  47. translationslisted 'with full Index'
  48. # No Release file at all, so no records about Translation files
  49. # (fallback to guessing)
  50. find aptarchive \( -name 'Release' -o -name 'InRelease' \) -delete
  51. echo 'Acquire::AllowInsecureRepositories "true";' > rootdir/etc/apt/apt.conf.d/allow-insecure-repositories.conf
  52. msgtest 'Download of en as forced language' 'without Index'
  53. testwarning --nomsg aptget update -o Acquire::Languages=en
  54. testsuccess grep -q -e 'Translation-en ' rootdir/tmp/testwarning.output
  55. rm -rf rootdir/var/lib/apt/lists
  56. msgtest 'Download of nothing else in forced language' 'without Index'
  57. testwarning --nomsg aptget update -o Acquire::Languages=en
  58. testfailure grep -q -e 'Translation-[^e][^n] ' rootdir/tmp/testwarning.output
  59. rm -rf rootdir/var/lib/apt/lists
  60. msgtest 'Download of ast_DE as forced language' 'without Index'
  61. testwarning --nomsg aptget update -o Acquire::Languages=ast_DE
  62. testsuccess grep -q -e 'Translation-ast_DE$' rootdir/tmp/testwarning.output
  63. rm -rf rootdir/var/lib/apt/lists
  64. msgtest 'Download of nothing else in forced language' 'without Index'
  65. testwarning --nomsg aptget update -o Acquire::Languages=ast_DE
  66. testfailure grep -q -e 'Translation-[^a][^s]' rootdir/tmp/testwarning.output
  67. rm -rf rootdir/var/lib/apt/lists
  68. msgtest 'Download of nothing if none is forced' 'without Index'
  69. testwarning --nomsg aptget update -o Acquire::Languages=none
  70. testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output
  71. rm -rf rootdir/var/lib/apt/lists
  72. mkdir -p rootdir/var/lib/apt/lists
  73. touch rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-ast_DE
  74. msgtest 'Download of builtin files' 'without Index'
  75. testwarning --nomsg aptget update
  76. testsuccess grep -q -e 'Translation-ast_DE' rootdir/tmp/testwarning.output
  77. rm -rf rootdir/var/lib/apt/lists
  78. mkdir -p rootdir/var/lib/apt/lists
  79. touch rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_i18n_Translation-ast_DE
  80. msgtest 'Download of nothing (even builtin) if none is forced' 'without Index'
  81. testwarning --nomsg aptget update -o Acquire::Languages=none
  82. testfailure grep -q -e 'Translation' rootdir/tmp/testwarning.output
  83. rm -rf rootdir/var/lib/apt/lists