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