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