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