]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-update-hashsum-mismatch
Merge branch 'debian/sid' into debian/experimental
[apt.git] / test / integration / test-apt-update-hashsum-mismatch
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'i386'
8 configcompression 'gz'
9
10 insertpackage 'testing' 'foo' 'all' '1'
11 insertpackage 'testing' 'foo2' 'all' '1'
12 insertsource 'testing' 'foo' 'all' '1'
13 insertsource 'testing' 'foo2' 'all' '1'
14
15 setupaptarchive --no-update
16 changetowebserver
17
18 echo 'Package: bar
19 Maintainer: Doctor Evil <evil@example.com>
20 Description: come to the dark side
21 ' > aptarchive/DoctorEvil
22 compressfile aptarchive/DoctorEvil
23
24 find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete
25
26 testsuccess aptget update
27 testsuccess aptcache show foo
28 testsuccess aptget install foo -s
29
30 for get in $(sed -n 's#^GET /\([^ ]\+\.gz\) HTTP.\+$#\1#p' aptarchive/webserver.log); do
31 msgmsg 'Test hashsum mismatch with file' "$get"
32 rm -rf rootdir/var/lib/apt/lists
33 webserverconfig 'aptwebserver::overwrite' ''
34 webserverconfig "aptwebserver::overwrite::$(printf '%s' "${get}" | sed 's#/#%2F#g' )::filename" '%2FDoctorEvil.gz'
35
36 TEST='testfailure'
37 if expr match "$get" '^.*Translation-.*$' >/dev/null; then
38 TEST='testsuccess'
39 unset get
40 fi
41 $TEST aptget update
42 cp rootdir/tmp/${TEST}.output rootdir/tmp/update.output
43 testsuccess grep -E "$(basename -s '.gz' "$get").*Hash Sum mismatch" rootdir/tmp/update.output
44 $TEST aptcache show foo
45 $TEST aptget install foo -s
46
47 testfailure aptcache show bar
48 testfailure aptget install bar -s
49 done