4 TESTDIR
="$(readlink -f "$(dirname "$0")")"
7 configarchitecture 'amd64' 'i386'
9 insertinstalledpackage 'cool' 'all' '1'
10 insertinstalledpackage 'stuff' 'all' '1'
11 insertinstalledpackage 'somestuff' 'all' '1' 'Depends: cool, stuff'
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
18 insertpackage 'unstable' 'badstuff' 'all' '2' 'Multi-Arch: foreign
20 insertpackage 'unstable' 'awesomecoolstuff' 'i386' '2' 'Depends: coolstuff, awesome'
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'
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
32 testfailure aptget install --solver dump coolstuff -s
33 testsuccess grep 'ERR_NO_FILENAME' rootdir/tmp/testfailure.output
34 testfailure test -s rootdir/var/log/apt/edsp.last.xz
35 export APT_EDSP_DUMP_FILENAME="/nonexistent
/apt
/edsp.dump
"
36 testfailure aptget install --solver dump coolstuff -s
37 testsuccess grep 'ERR_CREATE_FILE' rootdir/tmp/testfailure.output
38 testfailure test -s rootdir/var/log/apt/edsp.last.xz
39 export APT_EDSP_DUMP_FILENAME="${TMPWORKINGDIRECTORY}/downloaded
/dump.edsp
"
41 testfailureequal 'Reading package lists...
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!
49 E: External solver failed with: I am too dumb, i can just dump!' aptget install --solver dump coolstuff -s
50 testfailure test -s rootdir/var/log/apt/edsp.last.xz
51 testsuccess test -s "$APT_EDSP_DUMP_FILENAME"
53 testsuccessequal 'Reading package lists...
54 Building dependency tree...
55 Execute external solver...
56 The following NEW packages will be installed:
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
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"
68 testsuccessequal 'Reading package lists...
69 Building dependency tree...
70 Execute external solver...
71 The following NEW packages will be installed:
73 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded.
74 Inst coolstuff (3 experimental [amd64])
75 Conf coolstuff (3 experimental [amd64])' aptget install --solver apt coolstuff -s -t experimental
76 testfailure cmp rootdir/var/log/apt/edsp.last.xz rootdir/var/log/apt/edsp.last.xz.1
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
:
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
88 testsuccessequal 'Reading package lists...
89 Building dependency tree...
90 Execute external solver...
91 The following NEW packages will be installed:
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
97 testsuccessequal 'Reading package lists...
98 Building dependency tree...
99 Execute external solver...
100 The following packages will be REMOVED:
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:
111 0 upgraded, 0 newly installed, 3 to remove and 0 not upgraded.
114 Remv stuff [1]' aptget autoremove --solver apt somestuff -s
116 AUTOREMOVE='apt autoremove'
117 if [ -n "$SUDO_USER" ]; then
118 AUTOREMOVE="sudo
$AUTOREMOVE"
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
:
126 Use
'$AUTOREMOVE' to remove it.
127 The following packages will be REMOVED
:
129 0 upgraded
, 0 newly installed
, 2 to remove and
1 not upgraded.
131 Purg cool
[1]" aptget purge --solver apt cool -s
133 testsuccess aptget install awesomecoolstuff:i386 -s
134 testsuccess aptget install --solver apt awesomecoolstuff:i386 -s
136 rm -f "$APT_EDSP_DUMP_FILENAME"
137 testfailure aptget install --solver dump awesomecoolstuff:i386 -s
138 testsuccess test -s "$APT_EDSP_DUMP_FILENAME"
139 testequal 'Install: awesomecoolstuff:i386' grep :i386 "$APT_EDSP_DUMP_FILENAME"
140 testfailure grep -e ':amd64' -e 'Architecture: any' "$APT_EDSP_DUMP_FILENAME"
142 testsuccess aptget dist-upgrade -s
143 testsuccess aptget dist-upgrade -s --solver apt
145 testsuccess aptget upgrade -s
146 testsuccess aptget upgrade -s --solver apt
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
152 configarchitecture 'armel'
153 testfailure aptget install --solver apt awesomecoolstuff:i386 -s
154 msgtest 'An invalid EDSP file generates a' 'hard error'
155 if printf "%b
\n" "Request
: This is a
test\nFoo
: bar
\n\n" | aptinternalsolver > solver.result 2>&1; then
161 msgtest 'Test direct calling is okay for' 'apt-internal-solver'
162 cat "$APT_EDSP_DUMP_FILENAME" | aptinternalsolver > solver.result 2>&1 || true
163 if [ "$(tail -n2 solver.result | head -n1 )" = "Message
: Done
" ]; then
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
174 rm -f "$APT_EDSP_DUMP_FILENAME"
176 testsuccess aptinternalsolver scenario
177 testsuccessequal 'Package: stuff
187 a=experimental,n=experimental,c=main,b=all
200 a=unstable,n=sid,c=main,b=all
214 ' aptinternalsolver scenario stuff
216 cat > rootdir/usr/lib/apt/solvers/explicitremove << EOF
220 if [ "APT
-ID" = "\
${line%:*}" ]; then
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
234 cat > rootdir/usr/lib/apt/solvers/removeall << EOF
238 if [ "APT
-ID" = "\
${line%:*}" ]; then
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
250 cat > rootdir/usr/lib/apt/solvers/installall << EOF
254 if [ "APT-ID" = "\${line%:*}" ]; then
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
266 testsolverfailuremsg() {
267 local SOLVER="rootdir/usr/lib/apt/solvers/$1"
268 echo "$2" > "$SOLVER"
270 testfailuremsg "$3" apt full-upgrade -s --solver $1
273 testsolverfailuremsg 'exit0withmsg
' "#!/bin/sh
274 echo 'Error
: instant
-exit
275 Message
: This solver exits instantly
'
276 exit 0" 'E
: External solver failed with
: This solver exits instantly
'
278 testsolverfailuremsg 'exit1withoutmsg
' "#!/bin/sh
279 exit 1" 'E
: Sub
-process exit1withoutmsg returned an error code
(1)'
281 testsolverfailuremsg 'exit1withmsg
' "#!/bin/sh
282 echo 'Error
: instant
-exit
283 Message
: This solver exits instantly
'
284 exit 1" 'E
: External solver failed with
: This solver exits instantly
285 E
: Sub
-process exit1withmsg returned an error code
(1)'