use 'best' hash for source authentication
[ntk/apt.git] / test / integration / test-bug-612958-use-dpkg-multiarch-config
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'i386'
8 setupaptarchive
9
10 insertinstalledpackage 'libapt' 'i386' '1.0'
11 insertinstalledpackage 'libapt' 'amd64' '1.0'
12 insertinstalledpackage 'libapt' 'armel' '1.0'
13
14 testpass() {
15 rm rootdir/var/cache/apt/*.bin
16 msgtest 'Test architecture handling' "$1 with $2"
17 testsuccess --nomsg aptcache show libapt:$2
18 }
19
20 testfail() {
21 rm rootdir/var/cache/apt/*.bin
22 msgtest 'Test architecture handling' "$1 with $2"
23 testfailure --nomsg aptcache show libapt:$2
24 }
25
26 testpass 'no config' 'i386'
27 testfail 'no config' 'amd64'
28 testfail 'no config' 'armel'
29
30 CONFFILE=rootdir/etc/apt/apt.conf.d/99multiarch
31 echo '#clear APT::Architectures;' >> $CONFFILE
32 echo 'APT::Architectures:: "i386";' >> $CONFFILE
33 echo 'APT::Architectures:: "amd64";' >> $CONFFILE
34
35 testpass 'apt config' 'i386'
36 testpass 'apt config' 'amd64'
37 testfail 'apt config' 'armel'
38
39 echo 'APT::Architectures:: "armel";' >> $CONFFILE
40
41 testpass 'apt config' 'armel'
42
43 rm $CONFFILE
44
45 echo '#clear APT::Architectures;' >> $CONFFILE
46 echo 'APT::Architectures "i386,amd64";' >> $CONFFILE
47
48 testpass 'apt config' 'i386'
49 testpass 'apt config' 'amd64'
50 testfail 'apt config' 'armel'
51
52 rm $CONFFILE
53
54 echo '#clear APT::Architectures;' >> $CONFFILE
55 echo 'Dir::Bin::dpkg "./dpkg-printer";' >> $CONFFILE
56
57 echo '#! /bin/sh
58 echo "amd64"' > ./dpkg-printer
59 chmod +x ./dpkg-printer
60
61 testpass 'dpkg config' 'i386'
62 testpass 'dpkg config' 'amd64'
63 testfail 'dpkg config' 'armel'
64
65 echo '#! /bin/sh
66 echo "amd64 armel"' > ./dpkg-printer
67
68 testpass 'dpkg config' 'i386'
69 testpass 'dpkg config' 'amd64'
70 testpass 'dpkg config' 'armel'
71
72 echo '#! /bin/sh
73 echo "amd64
74 armel"' > ./dpkg-printer
75
76 testpass 'dpkg config' 'i386'
77 testpass 'dpkg config' 'amd64'
78 testpass 'dpkg config' 'armel'
79
80 echo '#! /bin/sh
81 echo "amd64
82 i386"' > ./dpkg-printer
83
84 testpass 'dpkg config' 'i386'
85 testpass 'dpkg config' 'amd64'
86 testfail 'dpkg config' 'armel'