]> git.saurik.com Git - apt.git/blame_incremental - test/integration/test-compressed-indexes
merged from lp:~donkult/apt/sid
[apt.git] / test / integration / test-compressed-indexes
... / ...
CommitLineData
1#!/bin/sh
2set -e
3
4TESTDIR=$(readlink -f $(dirname $0))
5. $TESTDIR/framework
6
7setupenvironment
8configarchitecture "i386"
9
10buildsimplenativepackage "testpkg" "i386" "1.0"
11setupaptarchive
12
13local GOODSHOW="$(aptcache show testpkg)
14"
15local GOODPOLICY="$(aptcache policy testpkg)"
16local GOODSHOWSRC="$(aptcache showsrc testpkg)
17"
18
19test $(echo "$GOODSHOW" | grep -e '^Package: testpkg' -e '^Version: 1.0' -e '^Architecture: i386' | wc -l) -eq 3 || msgdie 'show is broken'
20testequal "$GOODSHOW" aptcache show testpkg
21test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^ Candidate:' -e '^ Installed: (none)' -e '500 file:/' | wc -l) -eq 4 || msgdie 'policy is broken'
22testequal "$GOODPOLICY" aptcache policy testpkg
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'
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"
49 aptget install -d testpkg -qq && msgpass || msgfail
50 msgtest "\tdeb file is present"; test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
51 aptget clean
52 msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
53 fi
54 rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
55 testequal "$GOODSHOW" aptcache show testpkg
56 testequal "$GOODSHOW" aptcache show testpkg
57 rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
58 testequal "$GOODPOLICY" aptcache policy testpkg
59 testequal "$GOODPOLICY" aptcache policy testpkg
60 rm rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
61 testequal "$GOODSHOWSRC" aptcache showsrc testpkg
62 testequal "$GOODSHOWSRC" aptcache showsrc testpkg
63 rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
64 rm -rf rootdir/var/cache/apt/archives
65 msgtest "Check if the source is aptgetable"
66 aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail
67 msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail
68 msgtest "\tdirectory is present"; test -d testpkg-1.0 && msgpass || msgfail
69 rm -rf testpkg-1.0
70}
71
72echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressindex
73msgmsg "File: Test with uncompressed indexes"
74testrun
75
76aptget update -qq -o Acquire::Pdiffs=1
77msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)"
78testrun
79
80aptget update -qq -o Acquire::Pdiffs=0
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
88aptget update -qq
89msgmsg "File: Test with compressed indexes"
90testrun "compressed"
91
92aptget update -qq -o Acquire::Pdiffs=1
93msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)"
94testrun "compressed"
95
96aptget update -qq -o Acquire::Pdiffs=0
97msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)"
98testrun "compressed"
99
100rm rootdir/etc/apt/apt.conf.d/02compressindex
101changetowebserver
102aptget update -qq
103local GOODPOLICY="$(aptcache policy testpkg)"
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
110aptget update -qq -o Acquire::Pdiffs=1
111msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)"
112testrun
113
114aptget update -qq -o Acquire::Pdiffs=0
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
122aptget update -qq
123msgmsg "HTTP: Test with compressed indexes"
124testrun "compressed"
125
126aptget update -qq -o Acquire::Pdiffs=1
127msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)"
128testrun "compressed"
129
130aptget update -qq -o Acquire::Pdiffs=0
131msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)"
132testrun "compressed"