]> git.saurik.com Git - apt.git/blob - test/integration/test-dpkg-assert-multi-arch
add failing regression test for bug #346386
[apt.git] / test / integration / test-dpkg-assert-multi-arch
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'amd64' 'i386'
8
9 buildsimplenativepackage 'native-pkg' 'amd64' '1.0' 'stable'
10 buildsimplenativepackage 'foreign-pkg' 'i386' '0.5' 'stable' 'Multi-Arch: foreign'
11 buildsimplenativepackage 'same-lib' 'amd64,i386' '0.5' 'stable' 'Multi-Arch: same'
12 buildsimplenativepackage 'all-pkg' 'all' '2.0' 'stable'
13 buildsimplenativepackage 'all-foreign-pkg' 'all' '2.0' 'stable' 'Multi-Arch: foreign'
14
15 setupaptarchive
16
17 testqualifier() {
18 msgtest 'Test with' $1 'for correct qualifier mode' $2
19 GIVEN="$(aptget install $1 -qq -o Debug::pkgDPkgPM=1 2>&1 | grep -v -- '--unpack' | sed -e 's/^.*--[^u][^ ]* \([^ ]*\).*$/\1/')"
20 if [ "$GIVEN" = "$2" ]; then
21 msgpass
22 else
23 echo
24 echo "$GIVEN"
25 msgfail
26 fi
27 }
28
29 # non-multiarch or "ubuntus" old multiarchified dpkg
30 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
31 echo '#! /bin/sh
32 if echo "$*" | grep -q -- "--assert-multi-arch"; then
33 echo >&2 'dpkg: Fehler: unbekannte Option --assert-multi-arch'
34 echo >&1 'dpkg: Info: unbekannte Option --assert-multi-arch'
35 return 2;
36 fi
37 return $*' > ./dpkg-wrapper
38 chmod +x ./dpkg-wrapper
39
40 testqualifier 'native-pkg' 'native-pkg'
41 testqualifier 'native-pkg:amd64' 'native-pkg'
42 testqualifier 'foreign-pkg' 'foreign-pkg:i386'
43 testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
44 testqualifier 'same-lib' 'same-lib'
45 testqualifier 'same-lib:amd64' 'same-lib'
46 testqualifier 'same-lib:i386' 'same-lib:i386'
47 testqualifier 'all-pkg' 'all-pkg'
48 testqualifier 'all-pkg:amd64' 'all-pkg'
49 testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
50 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
51 insertinstalledpackage 'all-pkg' 'amd64' '1.0'
52 insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
53 testqualifier 'all-pkg' 'all-pkg'
54 testqualifier 'all-pkg:amd64' 'all-pkg'
55 testqualifier 'all-foreign-pkg' 'all-foreign-pkg'
56 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg'
57 insertinstalledpackage 'always-all-pkg' 'all' '1.0'
58 insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
59 testqualifier 'all-pkg-' 'all-pkg'
60 testqualifier 'all-foreign-pkg-' 'all-foreign-pkg'
61 testqualifier 'always-all-pkg-' 'always-all-pkg'
62 testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg'
63
64 # multiarch dpkg (new interface version)
65
66 rm rootdir/var/lib/dpkg/status
67 touch rootdir/var/lib/dpkg/status
68 echo 'Dir::Bin::dpkg "./dpkg-wrapper";' > rootdir/etc/apt/apt.conf.d/99dpkgwrapper
69 echo '#! /bin/sh
70 if echo "$*" | grep -q -- "--assert-multi-arch"; then
71 return 0;
72 fi
73 return $*' > ./dpkg-wrapper
74
75 testqualifier 'native-pkg' 'native-pkg:amd64'
76 testqualifier 'native-pkg:amd64' 'native-pkg:amd64'
77 testqualifier 'foreign-pkg' 'foreign-pkg:i386'
78 testqualifier 'foreign-pkg:i386' 'foreign-pkg:i386'
79 testqualifier 'same-lib' 'same-lib:amd64'
80 testqualifier 'same-lib:amd64' 'same-lib:amd64'
81 testqualifier 'same-lib:i386' 'same-lib:i386'
82 testqualifier 'all-pkg' 'all-pkg:all'
83 testqualifier 'all-pkg:amd64' 'all-pkg:all'
84 testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
85 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
86 insertinstalledpackage 'all-pkg' 'amd64' '1.0'
87 insertinstalledpackage 'all-foreign-pkg' 'amd64' '1.0' 'Multi-Arch: foreign'
88 testqualifier 'all-pkg' 'all-pkg:all'
89 testqualifier 'all-pkg:amd64' 'all-pkg:all'
90 testqualifier 'all-foreign-pkg' 'all-foreign-pkg:all'
91 testqualifier 'all-foreign-pkg:amd64' 'all-foreign-pkg:all'
92 insertinstalledpackage 'always-all-pkg' 'all' '1.0'
93 insertinstalledpackage 'always-all-foreign-pkg' 'all' '1.0' 'Multi-Arch: foreign'
94 testqualifier 'all-pkg-' 'all-pkg:amd64'
95 testqualifier 'all-foreign-pkg-' 'all-foreign-pkg:amd64'
96 testqualifier 'always-all-pkg-' 'always-all-pkg:all'
97 testqualifier 'always-all-foreign-pkg-' 'always-all-foreign-pkg:all'