]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-compressed-indexes
testcases: do not allow warnings in testsuccess
[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 '.' 'xz' 'bz2' 'lzma' 'gz'
9configarchitecture 'i386'
10
11buildsimplenativepackage 'testpkg' 'i386' '1.0'
12
13buildaptarchive
14setupdistsaptarchive
15# fake a pdiff setup as apt wouldn't try pdiffs otherwise
16find 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
20SHA1-History:
21 adc83b19e793491b1c6ea0fd8b46cd9f32e592fc 33053002 2010-08-18-2013.28
22 ecfd1b19e793491b1c6ea123eabdcd9f32e592fc 33053001 2010-08-18-2013.29
23SHA1-Patches:
24 abc1fc0ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.28
25 dfe3444ac57cd83d41c63195a9342e2db5650257 19722 2010-08-18-0814.29' > $PATCHINDEX
26done
27generatereleasefiles
28signreleasefiles
29
30testrun() {
31 local F
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?)
42 ! test -e rootdir/var/lib/apt/lists/*diff_Index || F=1
43 else
44 # clear the faked pdiff indexes so the glob below works
45 rm -f rootdir/var/lib/apt/lists/*diff_Index
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
52 fi
53 if [ -n "$F" ]; then
54 cat rootdir/tmp/testsuccess.output
55 ls -laR rootdir/var/lib/apt/lists/
56 msgfail
57 else
58 msgpass
59 fi
60 msgtest 'Check if package is downloadable'
61 testsuccess --nomsg aptget download testpkg
62 msgtest '\tdeb file is present'; testsuccess --nomsg test -f testpkg_1.0_i386.deb
63 rm testpkg_1.0_i386.deb
64 testequal 'Reading package lists...
65Building dependency tree...
66The following NEW packages will be installed:
67 testpkg
680 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
69Inst testpkg (1.0 unstable [i386])
70Conf testpkg (1.0 unstable [i386])' aptget install testpkg -s
71 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
72 testequal "$GOODSHOW" aptcache show testpkg
73 testequal "$GOODSHOW" aptcache show testpkg
74 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
75 testequal "$GOODPOLICY" aptcache policy testpkg
76 testequal "$GOODPOLICY" aptcache policy testpkg
77 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
78 testequal "$GOODSHOWSRC" aptcache showsrc testpkg
79 testequal "$GOODSHOWSRC" aptcache showsrc testpkg
80 aptget clean
81 msgtest 'Check if the source is aptgetable'
82 testsuccess --nomsg aptget source testpkg
83 msgtest '\tdsc file is present'; testsuccess --nomsg test -f testpkg_1.0.dsc
84 msgtest '\tdirectory is present'; testsuccess --nomsg test -d testpkg-1.0
85 rm -rf testpkg-1.0*
86 testequal "$(aptcache show testpkg -o Acquire::Languages=none)
87" aptcache dumpavail
88}
89
90echo 'Debug::pkgAcquire::worker "true";
91debug::pkgAcquire::Auth "true";
92Debug::pkgAcquire::Diffs "true";
93Debug::Acquire::http "true";' > rootdir/etc/apt/apt.conf.d/99debugconf
94
95testovermethod() {
96 forcecompressor $2
97
98 for INDEX in 'false' 'true'; do
99 rm -rf rootdir/var/lib/apt/lists
100 echo "Acquire::GzipIndexes \"${INDEX}\";" > rootdir/etc/apt/apt.conf.d/02compressindex
101 local INDCOMP
102 if [ "$INDEX" = 'false' -o "$1" = 'cdrom' ]; then
103 INDCOMP='uncompressed'
104 else
105 INDCOMP='compressed'
106 fi
107
108 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX"
109 if [ "${1}" = 'cdrom' ]; then
110 testsuccess aptcdrom add </dev/null
111 fi
112 testsuccess aptget update
113 testrun "$INDCOMP"
114
115 if [ "${1}" != 'cdrom' ]; then
116 testsuccess aptget update -o Acquire::Pdiffs=1
117 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged with pdiffs)"
118 testrun "$INDCOMP"
119
120 testsuccess aptget update -o Acquire::Pdiffs=0
121 msgmsg "${1}: ${COMPRESSOR}: Test with $INDCOMP indexes gzip=$INDEX (update unchanged without pdiffs)"
122 testrun "$INDCOMP"
123 fi
124
125 rm rootdir/etc/apt/apt.conf.d/02compressindex
126 done
127}
128
129testsuccess aptget update
130GOODSHOW="$(aptcache show testpkg)
131"
132test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken'
133testequal "$GOODSHOW" aptcache show testpkg
134GOODSHOWSRC="$(aptcache showsrc testpkg)
135"
136test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken'
137testequal "$GOODSHOWSRC" aptcache showsrc testpkg
138GOODPOLICY="$(aptcache policy testpkg)"
139test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken'
140testequal "$GOODPOLICY" aptcache policy testpkg
141
142for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'file' $COMPRESSOR; done
143
144changetowebserver
145rm -rf rootdir/var/lib/apt/lists
146testsuccess aptget update
147GOODPOLICY="$(aptcache policy testpkg)"
148test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4 || msgdie 'policy is broken'
149testequal "$GOODPOLICY" aptcache policy testpkg
150
151for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'http' $COMPRESSOR; done
152
153changetocdrom 'Debian APT Testdisk 0.8.15'
154rm -rf rootdir/var/lib/apt/lists
155testsuccess aptcdrom add </dev/null
156GOODPOLICY="$(aptcache policy testpkg)"
157test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 cdrom://' | wc -l) -eq 4 || msgdie 'policy is broken'
158testequal "$GOODPOLICY" aptcache policy testpkg
159
160for COMPRESSOR in 'gzip' 'bzip2' 'lzma' 'xz'; do testovermethod 'cdrom' $COMPRESSOR; done