]> git.saurik.com Git - apt.git/blob - test/integration/test-external-dependency-solver-protocol
3654e705ca51a5e3d1e71cdf3e19e782660eb99e
[apt.git] / test / integration / test-external-dependency-solver-protocol
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6 setupenvironment
7 configarchitecture 'amd64' 'i386'
8
9 insertinstalledpackage 'cool' 'all' '1'
10 insertinstalledpackage 'stuff' 'all' '1'
11 insertinstalledpackage 'somestuff' 'all' '1' 'Depends: cool, stuff'
12
13 insertpackage 'unstable' 'cool' 'all' '2' 'Multi-Arch: foreign'
14 insertpackage 'unstable' 'stuff' 'all' '2' 'Multi-Arch: foreign'
15 insertpackage 'unstable' 'coolstuff' 'i386,amd64' '2' 'Depends: cool, stuff'
16 insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign
17 Conflicts: badstuff'
18 insertpackage 'unstable' 'badstuff' 'all' '2' 'Multi-Arch: foreign
19 Conflicts: awesome'
20 insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome'
21
22 insertpackage 'experimental' 'cool' 'all' '3' 'Multi-Arch: foreign'
23 insertpackage 'experimental' 'stuff' 'all' '3' 'Multi-Arch: foreign'
24 insertpackage 'experimental' 'coolstuff' 'i386,amd64' '3' 'Depends: cool, stuff'
25
26 setupaptarchive
27
28 testfailure aptget install --solver dump coolstuff -s
29 testsuccess grep ERR_NO_FILENAME rootdir/tmp/testfailure.output
30 export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded/dump.edsp"
31
32 testfailureequal 'Reading package lists...
33 Building dependency tree...
34 Execute external solver...
35 The solver encountered an error of type: ERR_JUST_DUMPING
36 The following information might help you to understand what is wrong:
37 I am too dumb, i can just dump!
38 Please use one of my friends instead!
39
40 E: External solver failed with: I am too dumb, i can just dump!' aptget install --solver dump coolstuff -s
41 testsuccess test -s "$APT_EDSP_DUMP_FILENAME"
42 rm -f "$APT_EDSP_DUMP_FILENAME"
43
44 testsuccessequal 'Reading package lists...
45 Building dependency tree...
46 Execute external solver...
47 The following NEW packages will be installed:
48 coolstuff
49 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
50 Inst coolstuff (2 unstable [amd64])
51 Conf coolstuff (2 unstable [amd64])' aptget install --solver apt coolstuff -s
52
53 testsuccessequal 'Reading package lists...
54 Building dependency tree...
55 Execute external solver...
56 The following NEW packages will be installed:
57 coolstuff
58 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
59 Inst coolstuff (3 experimental [amd64])
60 Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s -t experimental
61
62 testsuccessequal 'Reading package lists...
63 Building dependency tree...
64 Execute external solver...
65 The following packages will be REMOVED:
66 somestuff
67 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded.
68 Remv somestuff [1]' aptget autoremove --solver apt somestuff -s
69 testsuccess aptmark auto cool stuff
70 testsuccessequal 'Reading package lists...
71 Building dependency tree...
72 Reading state information...
73 Execute external solver...
74 The following packages will be REMOVED:
75 cool somestuff stuff
76 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
77 Remv somestuff [1]
78 Remv cool [1]
79 Remv stuff [1]' aptget autoremove --solver apt somestuff -s
80
81 testsuccessequal "Reading package lists...
82 Building dependency tree...
83 Reading state information...
84 Execute external solver...
85 The following package was automatically installed and is no longer required:
86 stuff
87 Use 'apt-get autoremove' to remove it.
88 The following packages will be REMOVED:
89 cool* somestuff*
90 0 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
91 Purg somestuff [1]
92 Purg cool [1]" aptget purge --solver apt cool -s
93
94 testsuccess aptget install awesomecoolstuff:i386 -s
95 testsuccess aptget install --solver apt awesomecoolstuff:i386 -s
96
97 rm -f "$APT_EDSP_DUMP_FILENAME"
98 testfailure aptget install --solver dump awesomecoolstuff:i386 -s
99 testsuccess test -s "$APT_EDSP_DUMP_FILENAME"
100 testequal 'Install: awesomecoolstuff:i386' grep :i386 "$APT_EDSP_DUMP_FILENAME"
101 testempty grep -e ':amd64' -e 'Architecture: any' "$APT_EDSP_DUMP_FILENAME"
102
103 testsuccess aptget dist-upgrade -s
104 testsuccess aptget dist-upgrade -s --solver apt
105
106 testsuccess aptget upgrade -s
107 testsuccess aptget upgrade -s --solver apt
108
109 testfailure aptget install awesome badstuff -s
110 testfailure aptget install awesome badstuff -s --solver apt
111 testsuccess grep 'ERR_UNSOLVABLE' rootdir/tmp/testfailure.output
112
113 configarchitecture 'armel'
114 msgtest 'Test direct calling is okay for' 'apt-internal-solver'
115 cat "$APT_EDSP_DUMP_FILENAME" | aptinternalsolver -q=0 > solver.result 2>&1 || true
116 if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then
117 msgpass
118 else
119 cat solver.result
120 msgfail
121 fi
122 rm -f "$APT_EDSP_DUMP_FILENAME"
123
124 testfailure aptget install --solver apt awesomecoolstuff:i386 -s
125
126 testsuccess aptinternalsolver scenario
127 testsuccessequal 'Package: stuff
128 Source: stuff
129 Architecture: all
130 Version: 1
131 Source-Version: 1
132 Installed: yes
133 APT-ID: 2
134 Priority: optional
135 Section: other
136 APT-Pin: 100
137 APT-Candidate: yes
138 ' aptinternalsolver scenario stuff