]>
Commit | Line | Data |
---|---|---|
8aec002f DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
8aec002f DK |
6 | setupenvironment |
7 | configarchitecture 'i386' | |
8aec002f DK |
8 | |
9 | testpass() { | |
7f8c0eed DK |
10 | msgtest 'Test architecture handling success' "$1 with $2" |
11 | rm -f archs.conf | |
12 | aptconfig dump --no-empty --format='%V%n' APT::Architectures > archs.conf | |
13 | testsuccess --nomsg grep "^$2\$" archs.conf | |
8aec002f DK |
14 | } |
15 | ||
16 | testfail() { | |
7f8c0eed DK |
17 | msgtest 'Test architecture handling failure' "$1 with $2" |
18 | rm -f archs.conf | |
19 | aptconfig dump --no-empty --format='%V%n' APT::Architectures > archs.conf | |
20 | testfailure --nomsg grep "^$2\$" archs.conf | |
8aec002f DK |
21 | } |
22 | ||
23 | testpass 'no config' 'i386' | |
24 | testfail 'no config' 'amd64' | |
25 | testfail 'no config' 'armel' | |
26 | ||
27 | CONFFILE=rootdir/etc/apt/apt.conf.d/99multiarch | |
28 | echo '#clear APT::Architectures;' >> $CONFFILE | |
29 | echo 'APT::Architectures:: "i386";' >> $CONFFILE | |
30 | echo 'APT::Architectures:: "amd64";' >> $CONFFILE | |
31 | ||
32 | testpass 'apt config' 'i386' | |
33 | testpass 'apt config' 'amd64' | |
34 | testfail 'apt config' 'armel' | |
35 | ||
36 | echo 'APT::Architectures:: "armel";' >> $CONFFILE | |
37 | ||
38 | testpass 'apt config' 'armel' | |
39 | ||
40 | rm $CONFFILE | |
41 | ||
a1b6a4e7 DK |
42 | echo '#clear APT::Architectures;' >> $CONFFILE |
43 | echo 'APT::Architectures "i386,amd64";' >> $CONFFILE | |
44 | ||
45 | testpass 'apt config' 'i386' | |
46 | testpass 'apt config' 'amd64' | |
47 | testfail 'apt config' 'armel' | |
48 | ||
49 | rm $CONFFILE | |
50 | ||
8aec002f DK |
51 | echo '#clear APT::Architectures;' >> $CONFFILE |
52 | echo 'Dir::Bin::dpkg "./dpkg-printer";' >> $CONFFILE | |
53 | ||
54 | echo '#! /bin/sh | |
55 | echo "amd64"' > ./dpkg-printer | |
56 | chmod +x ./dpkg-printer | |
57 | ||
58 | testpass 'dpkg config' 'i386' | |
59 | testpass 'dpkg config' 'amd64' | |
60 | testfail 'dpkg config' 'armel' | |
61 | ||
62 | echo '#! /bin/sh | |
63 | echo "amd64 armel"' > ./dpkg-printer | |
64 | ||
4df62de6 DK |
65 | testpass 'dpkg config' 'i386' |
66 | testpass 'dpkg config' 'amd64' | |
67 | testpass 'dpkg config' 'armel' | |
68 | ||
69 | echo '#! /bin/sh | |
70 | echo "amd64 | |
71 | armel"' > ./dpkg-printer | |
72 | ||
73 | testpass 'dpkg config' 'i386' | |
74 | testpass 'dpkg config' 'amd64' | |
8aec002f | 75 | testpass 'dpkg config' 'armel' |
4df62de6 DK |
76 | |
77 | echo '#! /bin/sh | |
78 | echo "amd64 | |
79 | i386"' > ./dpkg-printer | |
80 | ||
81 | testpass 'dpkg config' 'i386' | |
82 | testpass 'dpkg config' 'amd64' | |
83 | testfail 'dpkg config' 'armel' |