]> git.saurik.com Git - apt.git/blob - test/integration/test-debsrc-hashes
fix test-bug-602412-dequote-redirect by removing the aptget update size information
[apt.git] / test / integration / test-debsrc-hashes
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture "i386"
9
10 # pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is
11 # checking the best available hash (as it should), this will trigger
12 # a hash mismatch.
13
14 cat > aptarchive/Sources <<EOF
15 Package: pkg-md5-ok
16 Binary: pkg-md5-ok
17 Version: 1.0
18 Maintainer: Joe Sixpack <joe@example.org>
19 Architecture: i386
20 Files:
21 d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc
22 d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz
23
24 Package: pkg-sha256-ok
25 Binary: pkg-sha256-ok
26 Version: 1.0
27 Maintainer: Joe Sixpack <joe@example.org>
28 Architecture: i386
29 Files:
30 d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc
31 d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz
32 Checksums-Sha1:
33 da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc
34 da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz
35 Checksums-Sha256:
36 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc
37 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz
38
39 Package: pkg-sha256-bad
40 Binary: pkg-sha256-bad
41 Version: 1.0
42 Maintainer: Joe Sixpack <joe@example.org>
43 Architecture: i386
44 Files:
45 d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc
46 d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz
47 Checksums-Sha1:
48 da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc
49 da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz
50 Checksums-Sha256:
51 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.dsc
52 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.tar.gz
53 EOF
54
55 # create fetchable files
56 for x in "pkg-md5-ok" "pkg-sha256-ok" "pkg-sha256-bad"; do
57 touch aptarchive/${x}_1.0.dsc
58 touch aptarchive/${x}_1.0.tar.gz
59 done
60
61 testok() {
62 msgtest "Test for hash ok of" "$*"
63 $* 2>&1 | grep "Download complete" > /dev/null && msgpass || msgfail
64 }
65
66 testmismatch() {
67 msgtest "Test for hash mismatch of" "$*"
68 $* 2>&1 | grep "Hash Sum mismatch" > /dev/null && msgpass || msgfail
69 }
70
71 setupaptarchive
72 changetowebserver
73 aptget update -qq
74
75 testok aptget source -d pkg-md5-ok
76 testok aptget source -d pkg-sha256-ok
77 testmismatch aptget source -d pkg-sha256-bad