]> git.saurik.com Git - apt.git/blame - test/integration/test-compressed-indexes
Make the test more verbose and check for the negative case of a kernel that
[apt.git] / test / integration / test-compressed-indexes
CommitLineData
f213b6ea
DK
1#!/bin/sh
2set -e
3
9962ae93 4TESTDIR=$(readlink -f $(dirname $0))
f213b6ea
DK
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture "i386"
9
10buildsimplenativepackage "testpkg" "i386" "1.0"
11setupaptarchive
12
718f797c 13GOODSHOW="$(aptcache show testpkg)
f213b6ea 14"
718f797c
DK
15GOODPOLICY="$(aptcache policy testpkg)"
16GOODSHOWSRC="$(aptcache showsrc testpkg)
f213b6ea
DK
17"
18
b761356f 19test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken'
f213b6ea 20testequal "$GOODSHOW" aptcache show testpkg
b761356f 21test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken'
f213b6ea 22testequal "$GOODPOLICY" aptcache policy testpkg
b761356f 23test $(echo "$GOODSHOWSRC" | grep -e '^Package: testpkg' -e '^Format: 3.0 (native)' -e '^Files:' -e '^Checksums-Sha256:' | wc -l) -eq 4 || msgdie 'showsrc is broken'
f213b6ea
DK
24testequal "$GOODSHOWSRC" aptcache showsrc testpkg
25
26
27testrun() {
28 local F
29 if [ -e rootdir/var/lib/apt/lists/*localhost*Release ]; then
30 msgtest "Check if all index files are" "${1:-uncompressed}"
31 if [ "$1" = "compressed" ]; then
32 ! test -e rootdir/var/lib/apt/lists/*_Packages || F=1
33 ! test -e rootdir/var/lib/apt/lists/*_Sources || F=1
34 test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1
35 test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1
36 else
37 test -e rootdir/var/lib/apt/lists/*_Packages || F=1
38 test -e rootdir/var/lib/apt/lists/*_Sources || F=1
39 ! test -e rootdir/var/lib/apt/lists/*_Packages.gz || F=1
40 ! test -e rootdir/var/lib/apt/lists/*_Sources.gz || F=1
41 fi
42 if [ -n "$F" ]; then
43 ls -laR rootdir/var/lib/apt/lists/
44 msgfail
45 else
46 msgpass
47 fi
48 msgtest "Check if package is downloadable"
0440d936
DK
49 testsuccess --nomsg aptget install -d testpkg
50 msgtest "\tdeb file is present"; testsuccess --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb
f213b6ea 51 aptget clean
0440d936 52 msgtest "\tdeb file is gone"; testfailure --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb
f213b6ea 53 fi
8de79b68 54 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
f213b6ea
DK
55 testequal "$GOODSHOW" aptcache show testpkg
56 testequal "$GOODSHOW" aptcache show testpkg
8de79b68 57 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
f213b6ea
DK
58 testequal "$GOODPOLICY" aptcache policy testpkg
59 testequal "$GOODPOLICY" aptcache policy testpkg
8de79b68 60 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
f213b6ea
DK
61 testequal "$GOODSHOWSRC" aptcache showsrc testpkg
62 testequal "$GOODSHOWSRC" aptcache showsrc testpkg
8de79b68 63 aptget clean
f213b6ea 64 msgtest "Check if the source is aptgetable"
0440d936
DK
65 testsuccess --nomsg aptget source testpkg
66 msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc
67 msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0
f213b6ea
DK
68 rm -rf testpkg-1.0
69}
70
d88a49c8 71echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex
f213b6ea
DK
72msgmsg "File: Test with uncompressed indexes"
73testrun
74
0440d936 75testsuccess aptget update -o Acquire::Pdiffs=1
f213b6ea
DK
76msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)"
77testrun
78
0440d936 79testsuccess aptget update -o Acquire::Pdiffs=0
f213b6ea
DK
80msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)"
81testrun
82
83rm -rf rootdir/var/lib/apt/lists
84echo 'Acquire::CompressionTypes::Order:: "gz";
85Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
86
0440d936 87testsuccess aptget update
f213b6ea
DK
88msgmsg "File: Test with compressed indexes"
89testrun "compressed"
90
0440d936 91testsuccess aptget update -o Acquire::Pdiffs=1
f213b6ea
DK
92msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)"
93testrun "compressed"
94
0440d936 95testsuccess aptget update -o Acquire::Pdiffs=0
f213b6ea
DK
96msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)"
97testrun "compressed"
98
99rm rootdir/etc/apt/apt.conf.d/02compressindex
100changetowebserver
0440d936 101testsuccess aptget update
718f797c 102GOODPOLICY="$(aptcache policy testpkg)"
f213b6ea
DK
103test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 http://' | wc -l) -eq 4
104testequal "$GOODPOLICY" aptcache policy testpkg
105
106msgmsg "HTTP: Test with uncompressed indexes"
107testrun
108
0440d936 109testsuccess aptget update -o Acquire::Pdiffs=1
f213b6ea
DK
110msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)"
111testrun
112
0440d936 113testsuccess aptget update -o Acquire::Pdiffs=0
f213b6ea
DK
114msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)"
115testrun
116
117rm -rf rootdir/var/lib/apt/lists
118echo 'Acquire::CompressionTypes::Order:: "gz";
119Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
120
0440d936 121testsuccess aptget update
f213b6ea
DK
122msgmsg "HTTP: Test with compressed indexes"
123testrun "compressed"
124
0440d936 125testsuccess aptget update -o Acquire::Pdiffs=1
f213b6ea
DK
126msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)"
127testrun "compressed"
128
0440d936 129testsuccess aptget update -o Acquire::Pdiffs=0
f213b6ea
DK
130msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)"
131testrun "compressed"