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