]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-update-hashsum-mismatch
test/integration/test-srcrecord: Make executable
[apt.git] / test / integration / test-apt-update-hashsum-mismatch
CommitLineData
23397c9d
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
23397c9d
DK
6setupenvironment
7configarchitecture 'i386'
8configcompression 'gz'
9
10insertpackage 'testing' 'foo' 'all' '1'
11insertpackage 'testing' 'foo2' 'all' '1'
12insertsource 'testing' 'foo' 'all' '1'
13insertsource 'testing' 'foo2' 'all' '1'
14
15setupaptarchive --no-update
16changetowebserver
17
18echo 'Package: bar
19Maintainer: Doctor Evil <evil@example.com>
20Description: come to the dark side
21' > aptarchive/DoctorEvil
22compressfile aptarchive/DoctorEvil
23
24find aptarchive \( -name 'Packages' -o -name 'Sources' -o -name 'Translation-en' \) -delete
25
26testsuccess aptget update
27testsuccess aptcache show foo
28testsuccess aptget install foo -s
29
30for 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
9397ea94
MV
36 testfailure aptget update
37 cp rootdir/tmp/testfailure.output rootdir/tmp/update.output
3261271e 38 testsuccess grep -E "$(basename "$get" '.gz').*Hash Sum mismatch" rootdir/tmp/update.output
9397ea94
MV
39 testfailure aptcache show foo
40 testfailure aptget install foo -s
23397c9d
DK
41
42 testfailure aptcache show bar
43 testfailure aptget install bar -s
44done