summaryrefslogtreecommitdiff
path: root/test/integration/test-bug-624218-Translation-file-handling
blob: 4ec30ee0954d4ec987183458aa65b082b0404751 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework
setupenvironment
configarchitecture 'i386'

buildsimplenativepackage 'coolstuff' 'all' '1.0' 'unstable'

setupaptarchive

changetowebserver

rm -rf rootdir/var/lib/apt/lists

translationslisted() {
	msgtest 'No download of non-existent locals' "$1"
	LC_ALL="" aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
	rm -rf rootdir/var/lib/apt/lists

	msgtest 'Download of existent locals' "$1"
	LC_ALL="" aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
	rm -rf rootdir/var/lib/apt/lists

	msgtest 'Download of en in LC_ALL=C' "$1"
	LC_ALL=C aptget update | grep -q -e 'Translation-en ' && msgpass || msgfail
	rm -rf rootdir/var/lib/apt/lists

	msgtest 'Download of en as forced language' "$1"
	aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
	rm -rf rootdir/var/lib/apt/lists

	msgtest 'Download of nothing else in forced language' "$1"
	aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
	rm -rf rootdir/var/lib/apt/lists

	msgtest 'Download no Translation- if forced language is non-existent' "$1"
	aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-' && msgfail || msgpass
	rm -rf rootdir/var/lib/apt/lists

	msgtest 'Download of nothing if none is forced' "$1"
	aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
	rm -rf rootdir/var/lib/apt/lists
}

translationslisted 'with full Index'


# no records at all about Translation files (fallback to guessing)
find aptarchive -name 'Release' -or -name 'InRelease' | xargs rm -f
configallowinsecurerepositories "true";

msgtest 'Download of en as forced language' 'without Index'
aptget update -o Acquire::Languages=en | grep -q -e 'Translation-en ' && msgpass || msgfail
rm -rf rootdir/var/lib/apt/lists

msgtest 'Download of nothing else in forced language' 'without Index'
aptget update -o Acquire::Languages=en | grep -q -e 'Translation-[^e][^n] ' && msgfail || msgpass
rm -rf rootdir/var/lib/apt/lists

msgtest 'Download of ast_DE as forced language' 'without Index'
aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-ast_DE$' && msgpass || msgfail
rm -rf rootdir/var/lib/apt/lists

msgtest 'Download of nothing else in forced language' 'without Index'
aptget update -o Acquire::Languages=ast_DE | grep -q -e 'Translation-[^a][^s]' && msgfail || msgpass
rm -rf rootdir/var/lib/apt/lists

msgtest 'Download of nothing if none is forced' 'without Index'
aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
rm -rf rootdir/var/lib/apt/lists

mkdir -p rootdir/var/lib/apt/lists
touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE

msgtest 'Download of builtin files' 'without Index'
aptget update | grep -q -e 'Translation-ast_DE' && msgpass || msgfail
rm -rf rootdir/var/lib/apt/lists

mkdir -p rootdir/var/lib/apt/lists
touch rootdir/var/lib/apt/lists/localhost:8080_dists_unstable_main_i18n_Translation-ast_DE

msgtest 'Download of nothing (even builtin) if none is forced' 'without Index'
aptget update -o Acquire::Languages=none | grep -q -e 'Translation' && msgfail || msgpass
rm -rf rootdir/var/lib/apt/lists