]> git.saurik.com Git - apt.git/blob - test/integration/test-method-gpgv
add a testcase for support of various build-dependency types
[apt.git] / test / integration / test-method-gpgv
1 #!/bin/sh
2 set -e
3
4 TESTDIR="$(readlink -f "$(dirname "$0")")"
5 . "$TESTDIR/framework"
6
7 setupenvironment
8 configarchitecture 'i386'
9
10 cat > faked-apt-key <<EOF
11 #!/bin/sh
12 set -e
13 echo "FFOO"
14 find_gpgv_status_fd() {
15 while [ -n "\$1" ]; do
16 if [ "\$1" = '--status-fd' ]; then
17 shift
18 echo "\$1"
19 break
20 fi
21 shift
22 done
23 }
24 GPGSTATUSFD="\$(find_gpgv_status_fd "\$@")"
25 cat >&\${GPGSTATUSFD} gpgv.output
26 cat gpgv.output
27 EOF
28 chmod +x faked-apt-key
29
30 testgpgv() {
31 echo "$3" > gpgv.output
32 msgtest "$1" "$2"
33 gpgvmethod >method.output 2>&1 || true
34 testsuccess --nomsg grep "$2" method.output
35 }
36
37 testrun() {
38 testgpgv 'Good signed with long keyid' 'Good: GOODSIG 5A90D141DBAC8DAE,' '[GNUPG:] GOODSIG 5A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
39 [GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE'
40 testgpgv 'Good signed with fingerprint' 'Good: GOODSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE,' '[GNUPG:] GOODSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE Joe Sixpack (APT Testcases Dummy) <joe@example.org>
41 [GNUPG:] VALIDSIG 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE 2016-09-01 1472742625 0 4 0 1 11 00 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE'
42
43 testgpgv 'No Pubkey with long keyid' 'NoPubKey: NO_PUBKEY E8525D47528144E2,' '[GNUPG:] ERRSIG E8525D47528144E2 1 11 00 1472744666 9
44 [GNUPG:] NO_PUBKEY E8525D47528144E2'
45 testgpgv 'No Pubkey with fingerprint' 'NoPubKey: NO_PUBKEY DE66AECA9151AFA1877EC31DE8525D47528144E2,' '[GNUPG:] ERRSIG DE66AECA9151AFA1877EC31DE8525D47528144E2 1 11 00 1472744666 9
46 [GNUPG:] NO_PUBKEY DE66AECA9151AFA1877EC31DE8525D47528144E2'
47
48 testgpgv 'Expired key with long keyid' 'Worthless: EXPKEYSIG 4BC0A39C27CE74F9 Rex Expired <rex@example.org>,' '[GNUPG:] EXPKEYSIG 4BC0A39C27CE74F9 Rex Expired <rex@example.org>
49 [GNUPG:] VALIDSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 2016-09-01 1472742629 0 4 0 1 11 00 891CC50E605796A0C6E733F74BC0A39C27CE74F9'
50 testgpgv 'Expired key with fingerprint' 'Worthless: EXPKEYSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 Rex Expired <rex@example.org>,' '[GNUPG:] EXPKEYSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 Rex Expired <rex@example.org>
51 [GNUPG:] VALIDSIG 891CC50E605796A0C6E733F74BC0A39C27CE74F9 2016-09-01 1472742629 0 4 0 1 11 00 891CC50E605796A0C6E733F74BC0A39C27CE74F9'
52 }
53
54 gpgvmethod() {
55 echo '601 Configuration
56 Config-Item: Debug::Acquire::gpgv=1
57 Config-Item: Dir::Bin::apt-key=./faked-apt-key
58
59 600 URI Acquire
60 URI: file:///dev/null
61 Filename: /dev/zero
62 ' | runapt "${METHODSDIR}/gpgv"
63 }
64 testrun
65
66 gpgvmethod() {
67 echo '601 Configuration
68 Config-Item: Debug::Acquire::gpgv=1
69 Config-Item: Dir::Bin::apt-key=./faked-apt-key
70
71 600 URI Acquire
72 URI: file:///dev/null
73 Filename: /dev/zero
74 Signed-By: 34A8E9D18DB320F367E8EAA05A90D141DBAC8DAE
75 ' | runapt "${METHODSDIR}/gpgv"
76 }
77 testrun