]>
Commit | Line | Data |
---|---|---|
f213b6ea DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
9962ae93 | 4 | TESTDIR=$(readlink -f $(dirname $0)) |
f213b6ea DK |
5 | . $TESTDIR/framework |
6 | ||
7 | setupenvironment | |
5f982b9d DK |
8 | configcompression '.' 'xz' 'bz2' 'lzma' 'gz' |
9 | configarchitecture 'i386' | |
10 | ||
11 | buildsimplenativepackage 'testpkg' 'i386' '1.0' | |
12 | ||
13 | buildaptarchive | |
14 | setupdistsaptarchive | |
15 | # fake a pdiff setup as apt wouldn't try pdiffs otherwise | |
16 | find aptarchive -name 'Packages' -o -name 'Sources' | while read file; do | |
17 | mkdir "${file}.diff" | |
18 | PATCHINDEX="${file}.diff/Index" | |
19 | echo 'SHA1-Current: adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 0 | |
20 | SHA1-History: | |
21 | adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 33053002 2010-08-18-2013.28 | |
22 | ecfd1b19e793491b1c6ea123eabdcd9f32e592fc 33053001 2010-08-18-2013.29 | |
23 | SHA1-Patches: | |
24 | abc1fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28 | |
25 | dfe3444ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.29' > $PATCHINDEX | |
26 | done | |
27 | generatereleasefiles | |
28 | signreleasefiles | |
f213b6ea DK |
29 | |
30 | testrun() { | |
31 | local F | |
5f982b9d DK |
32 | msgtest 'Check if all index files are' "${1:-uncompressed}" |
33 | if [ "$1" = 'compressed' ]; then | |
34 | ! test -e rootdir/var/lib/apt/lists/*_Packages || F=1 | |
35 | ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1 | |
36 | ! test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1 | |
37 | test -e rootdir/var/lib/apt/lists/*_Packages.${COMPRESS} || F=1 | |
38 | test -e rootdir/var/lib/apt/lists/*_Sources.${COMPRESS} || F=1 | |
39 | test -e rootdir/var/lib/apt/lists/*_Translation-en.${COMPRESS} || F=1 | |
40 | # there is no point in trying pdiff if we have compressed indexes | |
41 | # as we can't patch compressed files (well, we can, but what is the point?) | |
4d0818cc | 42 | ! test -e rootdir/var/lib/apt/lists/*diff_Index || F=1 |
5f982b9d DK |
43 | else |
44 | # clear the faked pdiff indexes so the glob below works | |
4d0818cc | 45 | rm -f rootdir/var/lib/apt/lists/*diff_Index |
5f982b9d DK |
46 | test -e rootdir/var/lib/apt/lists/*_Packages || F=1 |
47 | test -e rootdir/var/lib/apt/lists/*_Sources || F=1 | |
48 | test -e rootdir/var/lib/apt/lists/*_Translation-en || F=1 | |
49 | ! test -e rootdir/var/lib/apt/lists/*_Packages.* || F=1 | |
50 | ! test -e rootdir/var/lib/apt/lists/*_Sources.* || F=1 | |
51 | ! test -e rootdir/var/lib/apt/lists/*_Translation-en.* || F=1 | |
f213b6ea | 52 | fi |
5f982b9d | 53 | if [ -n "$F" ]; then |
78bc8d6b | 54 | cat rootdir/tmp/testsuccess.output |
5f982b9d DK |
55 | ls -laR rootdir/var/lib/apt/lists/ |
56 | msgfail | |
57 | else | |
58 | msgpass | |
59 | fi | |
60 | msgtest 'Check if package is downloadable' | |
03aa0847 | 61 | cd downloaded |
5f982b9d | 62 | testsuccess --nomsg aptget download testpkg |
653ef26c | 63 | msgtest 'deb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb |
a09f6eb8 | 64 | rm -f testpkg_1.0_i386.deb |
03aa0847 | 65 | cd - >/dev/null |
25b86db1 | 66 | testsuccessequal 'Reading package lists... |
5f982b9d DK |
67 | Building dependency tree... |
68 | The following NEW packages will be installed: | |
69 | testpkg | |
70 | 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. | |
71 | Inst testpkg (1.0 unstable [i386]) | |
72 | Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s | |
8de79b68 | 73 | rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin |
25b86db1 DK |
74 | testsuccessequal "$GOODSHOW" aptcache show testpkg |
75 | testsuccessequal "$GOODSHOW" aptcache show testpkg | |
8de79b68 | 76 | rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin |
25b86db1 DK |
77 | testsuccessequal "$GOODPOLICY" aptcache policy testpkg |
78 | testsuccessequal "$GOODPOLICY" aptcache policy testpkg | |
8de79b68 | 79 | rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin |
25b86db1 DK |
80 | testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg |
81 | testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg | |
8de79b68 | 82 | aptget clean |
5f982b9d | 83 | msgtest 'Check if the source is aptgetable' |
03aa0847 | 84 | cd downloaded |
0440d936 | 85 | testsuccess --nomsg aptget source testpkg |
03aa0847 DK |
86 | testsuccess test -s testpkg_1.0.dsc |
87 | testsuccess test -d testpkg-1.0 | |
5f982b9d | 88 | rm -rf testpkg-1.0* |
03aa0847 | 89 | cd - >/dev/null |
25b86db1 | 90 | testsuccessequal "$(aptcache show testpkg -o Acquire::Languages=none) |
4dde2b42 | 91 | " aptcache dumpavail |
f213b6ea DK |
92 | } |
93 | ||
5f982b9d DK |
94 | echo 'Debug::pkgAcquire::worker "true"; |
95 | debug::pkgAcquire::Auth "true"; | |
70b63c57 DK |
96 | Debug::pkgAcquire::Diffs "true"; |
97 | Debug::Acquire::http "true";' > rootdir/etc/apt/apt.conf.d/99debugconf | |
f213b6ea | 98 | |
5f982b9d DK |
99 | testovermethod() { |
100 | forcecompressor $2 | |
f213b6ea | 101 | |
5f982b9d DK |
102 | for INDEX in 'false' 'true'; do |
103 | rm -rf rootdir/var/lib/apt/lists | |
104 | echo "Acquire::GzipIndexes \"${INDEX}\";" > rootdir/etc/apt/apt.conf.d/02compressindex | |
105 | local INDCOMP | |
70b63c57 | 106 | if [ "$INDEX" = 'false' -o "$1" = 'cdrom' ]; then |
5f982b9d DK |
107 | INDCOMP='uncompressed' |
108 | else | |
109 | INDCOMP='compressed' | |
110 | fi | |
f213b6ea | 111 | |
70b63c57 DK |
112 | msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX" |
113 | if [ "${1}" = 'cdrom' ]; then | |
114 | testsuccess aptcdrom add </dev/null | |
115 | fi | |
116 | testsuccess aptget update | |
5f982b9d | 117 | testrun "$INDCOMP" |
f213b6ea | 118 | |
70b63c57 DK |
119 | if [ "${1}" != 'cdrom' ]; then |
120 | testsuccess aptget update -o Acquire::Pdiffs=1 | |
121 | msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged with pdiffs)" | |
122 | testrun "$INDCOMP" | |
f213b6ea | 123 | |
70b63c57 DK |
124 | testsuccess aptget update -o Acquire::Pdiffs=0 |
125 | msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged without pdiffs)" | |
126 | testrun "$INDCOMP" | |
127 | fi | |
f213b6ea | 128 | |
5f982b9d DK |
129 | rm rootdir/etc/apt/apt.conf.d/02compressindex |
130 | done | |
131 | } | |
f213b6ea | 132 | |
0440d936 | 133 | testsuccess aptget update |
5f982b9d DK |
134 | GOODSHOW="$(aptcache show testpkg) |
135 | " | |
136 | test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken' | |
25b86db1 | 137 | testsuccessequal "$GOODSHOW" aptcache show testpkg |
5f982b9d DK |
138 | GOODSHOWSRC="$(aptcache showsrc testpkg) |
139 | " | |
140 | test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken' | |
25b86db1 | 141 | testsuccessequal "$GOODSHOWSRC" aptcache showsrc testpkg |
718f797c | 142 | GOODPOLICY="$(aptcache policy testpkg)" |
5f982b9d | 143 | test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken' |
25b86db1 | 144 | testsuccessequal "$GOODPOLICY" aptcache policy testpkg |
f213b6ea | 145 | |
5f982b9d | 146 | for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'file' $COMPRESSOR; done |
f213b6ea | 147 | |
5f982b9d | 148 | changetowebserver |
f213b6ea | 149 | rm -rf rootdir/var/lib/apt/lists |
0440d936 | 150 | testsuccess aptget update |
5f982b9d DK |
151 | GOODPOLICY="$(aptcache policy testpkg)" |
152 | test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'policy is broken' | |
25b86db1 | 153 | testsuccessequal "$GOODPOLICY" aptcache policy testpkg |
f213b6ea | 154 | |
5f982b9d | 155 | for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'http' $COMPRESSOR; done |
70b63c57 DK |
156 | |
157 | changetocdrom 'Debian APT Testdisk 0.8.15' | |
158 | rm -rf rootdir/var/lib/apt/lists | |
159 | testsuccess aptcdrom add </dev/null | |
160 | GOODPOLICY="$(aptcache policy testpkg)" | |
161 | test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 cdrom://' | wc -l) -eq 4 || msgdie 'policy is broken' | |
25b86db1 | 162 | testsuccessequal "$GOODPOLICY" aptcache policy testpkg |
70b63c57 DK |
163 | |
164 | for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'cdrom' $COMPRESSOR; done |