]>
Commit | Line | Data |
---|---|---|
1f6cf9e7 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
1f6cf9e7 DK |
6 | setupenvironment |
7 | configarchitecture 'amd64' 'i386' | |
8 | ||
9 | insertinstalledpackage 'cool' 'all' '1' | |
10 | insertinstalledpackage 'stuff' 'all' '1' | |
188a6fcf | 11 | insertinstalledpackage 'somestuff' 'all' '1' 'Depends: cool, stuff' |
1f6cf9e7 DK |
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' | |
081c9d44 DK |
16 | insertpackage 'unstable' 'awesome' 'all' '2' 'Multi-Arch: foreign |
17 | Conflicts: badstuff' | |
18 | insertpackage 'unstable' 'badstuff' 'all' '2' 'Multi-Arch: foreign | |
19 | Conflicts: awesome' | |
1f6cf9e7 DK |
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 | ||
385d9f2f DK |
28 | testsuccess aptget install --solver apt coolstuff -s |
29 | testempty find -name 'edsp.last.*' | |
30 | echo 'Dir::Log::Solver "edsp.last.xz";' > rootdir/etc/apt/apt.conf.d/log-edsp.conf | |
31 | ||
92b2e38d | 32 | testfailure aptget install --solver dump coolstuff -s |
385d9f2f DK |
33 | testsuccess grep 'ERR_NO_FILENAME' rootdir/tmp/testfailure.output |
34 | testfailure test -s rootdir/var/log/apt/edsp.last.xz | |
7414af7f DK |
35 | export APT_EDSP_DUMP_FILENAME="/nonexistent/apt/edsp.dump" |
36 | testfailure aptget install --solver dump coolstuff -s | |
385d9f2f DK |
37 | testsuccess grep 'ERR_CREATE_FILE' rootdir/tmp/testfailure.output |
38 | testfailure test -s rootdir/var/log/apt/edsp.last.xz | |
92b2e38d DK |
39 | export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded/dump.edsp" |
40 | ||
25b86db1 | 41 | testfailureequal 'Reading package lists... |
1f6cf9e7 DK |
42 | Building dependency tree... |
43 | Execute external solver... | |
44 | The solver encountered an error of type: ERR_JUST_DUMPING | |
45 | The following information might help you to understand what is wrong: | |
46 | I am too dumb, i can just dump! | |
47 | Please use one of my friends instead! | |
48 | ||
49 | E: External solver failed with: I am too dumb, i can just dump!' aptget install --solver dump coolstuff -s | |
385d9f2f | 50 | testfailure test -s rootdir/var/log/apt/edsp.last.xz |
92b2e38d | 51 | testsuccess test -s "$APT_EDSP_DUMP_FILENAME" |
1f6cf9e7 | 52 | |
188a6fcf DK |
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 (2 unstable [amd64]) | |
60 | Conf coolstuff (2 unstable [amd64])' aptget install --solver apt coolstuff -s | |
385d9f2f DK |
61 | testsuccess test -s rootdir/var/log/apt/edsp.last.xz |
62 | sed -i -e 's#^Solver: dump$#Solver: apt#' "$APT_EDSP_DUMP_FILENAME" | |
63 | testequal "$(cat "$APT_EDSP_DUMP_FILENAME") | |
64 | " apthelper cat-file rootdir/var/log/apt/edsp.last.xz | |
65 | cp rootdir/var/log/apt/edsp.last.xz rootdir/var/log/apt/edsp.last.xz.1 | |
66 | rm -f "$APT_EDSP_DUMP_FILENAME" | |
188a6fcf | 67 | |
25b86db1 | 68 | testsuccessequal 'Reading package lists... |
1f6cf9e7 DK |
69 | Building dependency tree... |
70 | Execute external solver... | |
71 | The following NEW packages will be installed: | |
72 | coolstuff | |
73 | 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. | |
74 | Inst coolstuff (3 experimental [amd64]) | |
188a6fcf | 75 | Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s -t experimental |
385d9f2f | 76 | testfailure cmp rootdir/var/log/apt/edsp.last.xz rootdir/var/log/apt/edsp.last.xz.1 |
1f6cf9e7 | 77 | |
294a8020 DK |
78 | testsuccessequal "Reading package lists... |
79 | Building dependency tree... | |
80 | Selected version '3' (experimental [amd64]) for 'coolstuff' | |
81 | Execute external solver... | |
82 | The following NEW packages will be installed: | |
83 | coolstuff | |
84 | 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. | |
85 | Inst coolstuff (3 experimental [amd64]) | |
86 | Conf coolstuff (3 experimental [amd64])" aptget install --solver apt coolstuff/experimental -sq=0 | |
87 | ||
88 | testsuccessequal 'Reading package lists... | |
89 | Building dependency tree... | |
90 | Execute external solver... | |
91 | The following NEW packages will be installed: | |
92 | coolstuff | |
93 | 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. | |
94 | Inst coolstuff (3 experimental [amd64]) | |
95 | Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff=3 -sq=0 | |
96 | ||
25b86db1 | 97 | testsuccessequal 'Reading package lists... |
081c9d44 DK |
98 | Building dependency tree... |
99 | Execute external solver... | |
100 | The following packages will be REMOVED: | |
188a6fcf DK |
101 | somestuff |
102 | 0 upgraded, 0 newly installed, 1 to remove and 2 not upgraded. | |
103 | Remv somestuff [1]' aptget autoremove --solver apt somestuff -s | |
104 | testsuccess aptmark auto cool stuff | |
105 | testsuccessequal 'Reading package lists... | |
106 | Building dependency tree... | |
107 | Reading state information... | |
108 | Execute external solver... | |
109 | The following packages will be REMOVED: | |
110 | cool somestuff stuff | |
111 | 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded. | |
112 | Remv somestuff [1] | |
113 | Remv cool [1] | |
114 | Remv stuff [1]' aptget autoremove --solver apt somestuff -s | |
115 | ||
73fe49f9 DK |
116 | AUTOREMOVE='apt autoremove' |
117 | if [ -n "$SUDO_USER" ]; then | |
118 | AUTOREMOVE="sudo $AUTOREMOVE" | |
119 | fi | |
188a6fcf DK |
120 | testsuccessequal "Reading package lists... |
121 | Building dependency tree... | |
122 | Reading state information... | |
123 | Execute external solver... | |
124 | The following package was automatically installed and is no longer required: | |
125 | stuff | |
73fe49f9 | 126 | Use '$AUTOREMOVE' to remove it. |
188a6fcf DK |
127 | The following packages will be REMOVED: |
128 | cool* somestuff* | |
90e7fba4 | 129 | 0 upgraded, 0 newly installed, 2 to remove and 1 not upgraded. |
188a6fcf DK |
130 | Purg somestuff [1] |
131 | Purg cool [1]" aptget purge --solver apt cool -s | |
081c9d44 | 132 | |
1f6cf9e7 DK |
133 | testsuccess aptget install awesomecoolstuff:i386 -s |
134 | testsuccess aptget install --solver apt awesomecoolstuff:i386 -s | |
135 | ||
92b2e38d | 136 | rm -f "$APT_EDSP_DUMP_FILENAME" |
1f6cf9e7 | 137 | testfailure aptget install --solver dump awesomecoolstuff:i386 -s |
92b2e38d DK |
138 | testsuccess test -s "$APT_EDSP_DUMP_FILENAME" |
139 | testequal 'Install: awesomecoolstuff:i386' grep :i386 "$APT_EDSP_DUMP_FILENAME" | |
a66e1837 | 140 | testfailure grep -e ':amd64' -e 'Architecture: any' "$APT_EDSP_DUMP_FILENAME" |
1f6cf9e7 | 141 | |
172947cd DK |
142 | testsuccess aptget dist-upgrade -s |
143 | testsuccess aptget dist-upgrade -s --solver apt | |
144 | ||
145 | testsuccess aptget upgrade -s | |
146 | testsuccess aptget upgrade -s --solver apt | |
147 | ||
081c9d44 DK |
148 | testfailure aptget install awesome badstuff -s |
149 | testfailure aptget install awesome badstuff -s --solver apt | |
150 | testsuccess grep 'ERR_UNSOLVABLE' rootdir/tmp/testfailure.output | |
151 | ||
1f6cf9e7 | 152 | configarchitecture 'armel' |
7414af7f DK |
153 | testfailure aptget install --solver apt awesomecoolstuff:i386 -s |
154 | msgtest 'An invalid EDSP file generates a' 'hard error' | |
87d6947d | 155 | if echo "Request: This is a test\nFoo: bar\n\n" | aptinternalsolver > solver.result 2>&1; then |
7414af7f DK |
156 | cat solver.result |
157 | msgfail | |
158 | else | |
159 | msgpass | |
160 | fi | |
1f6cf9e7 | 161 | msgtest 'Test direct calling is okay for' 'apt-internal-solver' |
87d6947d | 162 | cat "$APT_EDSP_DUMP_FILENAME" | aptinternalsolver > solver.result 2>&1 || true |
1f6cf9e7 DK |
163 | if [ "$(tail -n2 solver.result | head -n1 )" = "Message: Done" ]; then |
164 | msgpass | |
165 | else | |
166 | cat solver.result | |
167 | msgfail | |
168 | fi | |
307d9eb2 DK |
169 | testsuccess grep '^APT-ID: 1$' "$APT_EDSP_DUMP_FILENAME" |
170 | sed -i -e 's#^APT-ID: 1$#APT-ID: 10000#' "$APT_EDSP_DUMP_FILENAME" | |
171 | cat "$APT_EDSP_DUMP_FILENAME" | aptinternalsolver > solver.result 2>&1 || true | |
172 | testsuccessequal 'Message: Done | |
173 | ' tail -n2 solver.result | |
92b2e38d | 174 | rm -f "$APT_EDSP_DUMP_FILENAME" |
1f6cf9e7 | 175 | |
081c9d44 | 176 | testsuccess aptinternalsolver scenario |
25b86db1 | 177 | testsuccessequal 'Package: stuff |
081c9d44 | 178 | Architecture: all |
1dd20368 | 179 | Version: 3 |
1dd20368 | 180 | APT-ID: 1 |
5caf35a7 DK |
181 | Multi-Arch: foreign |
182 | Source: stuff | |
183 | Source-Version: 3 | |
1dd20368 DK |
184 | Priority: optional |
185 | Section: other | |
1dd20368 DK |
186 | APT-Release: |
187 | a=experimental,n=experimental,c=main,b=all | |
188 | APT-Pin: 1 | |
189 | ||
190 | Package: stuff | |
1dd20368 DK |
191 | Architecture: all |
192 | Version: 2 | |
1dd20368 | 193 | APT-ID: 3 |
5caf35a7 DK |
194 | Multi-Arch: foreign |
195 | Source: stuff | |
196 | Source-Version: 2 | |
1dd20368 DK |
197 | Priority: optional |
198 | Section: other | |
1dd20368 DK |
199 | APT-Release: |
200 | a=unstable,n=sid,c=main,b=all | |
201 | APT-Pin: 500 | |
202 | APT-Candidate: yes | |
203 | ||
204 | Package: stuff | |
1dd20368 | 205 | Architecture: all |
081c9d44 | 206 | Version: 1 |
1dd20368 | 207 | APT-ID: 8 |
5caf35a7 DK |
208 | Source: stuff |
209 | Source-Version: 1 | |
081c9d44 DK |
210 | Priority: optional |
211 | Section: other | |
5caf35a7 | 212 | Installed: yes |
081c9d44 | 213 | APT-Pin: 100 |
081c9d44 | 214 | ' aptinternalsolver scenario stuff |
90e7fba4 DK |
215 | |
216 | cat > rootdir/usr/lib/apt/solvers/explicitremove << EOF | |
217 | #!/bin/sh | |
218 | set -e | |
219 | while read line; do | |
220 | if [ "APT-ID" = "\${line%:*}" ]; then | |
221 | cat << APT | |
222 | Install: \${line#*:} | |
223 | ||
224 | Remove: \${line#*:} | |
225 | ||
226 | APT | |
227 | fi | |
228 | done | |
229 | EOF | |
230 | chmod +x rootdir/usr/lib/apt/solvers/explicitremove | |
231 | testfailure apt full-upgrade -s --solver explicitremove | |
232 | testsuccess grep 'had a previous stanza' rootdir/tmp/testfailure.output | |
233 | ||
234 | cat > rootdir/usr/lib/apt/solvers/removeall << EOF | |
235 | #!/bin/sh | |
236 | set -e | |
237 | while read line; do | |
238 | if [ "APT-ID" = "\${line%:*}" ]; then | |
239 | cat << APT | |
240 | Remove: \${line#*:} | |
241 | ||
242 | APT | |
243 | fi | |
244 | done | |
245 | EOF | |
246 | chmod +x rootdir/usr/lib/apt/solvers/removeall | |
247 | testwarning apt full-upgrade -s --solver removeall | |
248 | testsuccess grep "which isn't installed!" rootdir/tmp/testwarning.output | |
249 | ||
250 | cat > rootdir/usr/lib/apt/solvers/installall << EOF | |
251 | #!/bin/sh | |
252 | set -e | |
253 | while read line; do | |
254 | if [ "APT-ID" = "\${line%:*}" ]; then | |
255 | cat << APT | |
256 | Install: \${line#*:} | |
257 | ||
258 | APT | |
259 | fi | |
260 | done | |
261 | EOF | |
262 | chmod +x rootdir/usr/lib/apt/solvers/installall | |
263 | testfailure apt full-upgrade -s --solver installall | |
264 | testsuccess grep "is already installed!" rootdir/tmp/testfailure.output |