]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-cache
a8ddfd88936c87c0190c4d7f855a6650f8362136
[apt.git] / test / integration / test-apt-cache
1 #!/bin/sh
2 set -e
3
4 TESTDIR=$(readlink -f $(dirname $0))
5 . $TESTDIR/framework
6
7 setupenvironment
8 configarchitecture 'amd64' 'i386'
9
10 DESCR='Some description
11 That has multiple lines'
12 insertpackage 'unstable' 'fancy' 'all' '1'
13 insertpackage 'unstable,installed' 'foo' 'all' '1' 'Depends: bar
14 Conflicts: foobar
15 Recommends: cool (>= 2) | cooler (<< 5)' "$DESCR"
16 insertpackage 'unstable' 'bar' 'all' '1' 'Depends: bar
17 Breaks: foo (<< 1)
18 Replaces: foo (<< 1)' "$DESCR"
19 insertpackage 'unstable' 'specific' 'all' '1' 'Depends: bar:i386, specific:amd64
20 Breaks: foo:amd64 (<< 1)
21 Replaces: foo:i386 (<< 1)' "$DESCR"
22
23 setupaptarchive
24
25 # dpkg is installed by our framework
26 testdpkginstalled 'dpkg'
27 testempty aptcache unmet dpkg
28
29 # FIXME: Find some usecase for unmet as it seems kinda useless/broken
30 #testsuccess aptcache unmet
31 #testsuccess aptcache unmet foo
32
33 # not too useful to test, but makes coverage green…
34 testsuccess aptcache stats
35 cp rootdir/tmp/testsuccess.output stats.output
36 testsuccess test -s stats.output
37 testsuccess aptcache xvcg foo
38 cp rootdir/tmp/testsuccess.output xvcg.output
39 testsuccess test -s xvcg.output
40 testsuccess aptcache dotty foo
41 cp rootdir/tmp/testsuccess.output dotty.output
42 testsuccess test -s dotty.output
43 # for this, even the sourcecode says it is useless (expect debugging)
44 testsuccess aptcache dump
45 cp rootdir/tmp/testsuccess.output dump.output
46 testsuccess test -s dump.output
47
48 testsuccessequal 'dpkg
49 bar
50 specific
51 fancy
52 foo' aptcache pkgnames
53 testsuccessequal 'bar' aptcache pkgnames bar
54 testsuccessequal 'fancy
55 foo' aptcache pkgnames f
56
57 testsuccessequal " foo | 1 | file:$(readlink -f .)/aptarchive unstable/main amd64 Packages" aptcache madison foo
58
59 ### depends
60
61 testsuccessequal 'foo
62 Depends: bar
63 Conflicts: <foobar>
64 |Recommends: <cool>
65 Recommends: <cooler>' aptcache depends foo
66 testsuccessequal 'foo
67 Depends: bar
68 Conflicts: <foobar>
69 Conflicts: <foobar:i386>
70 |Recommends: <cool>
71 Recommends: <cooler>' aptcache depends foo --implicit
72 testsuccessequal 'foo
73 Depends: bar
74 Conflicts: <foobar>
75 Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
76 testsuccessequal 'foo
77 Depends: bar
78 Conflicts: <foobar>
79 Conflicts: <foobar:i386>
80 Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit
81 testsuccessequal 'foo
82 Depends: bar
83 Conflicts: <foobar>
84 |Recommends: <cool> (>= 2)
85 Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1
86 testsuccessequal 'foo
87 Depends: bar
88 Conflicts: <foobar>
89 Conflicts: <foobar:i386>
90 |Recommends: <cool> (>= 2)
91 Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit
92 testsuccessequal 'foo
93 Depends: bar
94 Conflicts: <foobar>' aptcache depends foo --no-recommends
95 testsuccessequal 'foo
96 Depends: bar
97 Conflicts: <foobar>
98 Conflicts: <foobar:i386>' aptcache depends foo --no-recommends --implicit
99 testsuccessequal 'foo
100 Depends: bar' aptcache depends foo --important --implicit
101 testsuccessequal 'foo
102 Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts
103 testsuccessequal 'foo
104 Conflicts: <foobar>
105 Conflicts: <foobar:i386>' aptcache depends foo --important --no-depends --conflicts --implicit
106 testsuccessequal 'foo
107 Depends: bar
108 Conflicts: <foobar>
109 |Recommends: <cool>
110 Recommends: <cooler>
111 bar
112 Depends: bar
113 Breaks: foo
114 Replaces: foo
115 <foobar>
116 <cool>
117 <cooler>' aptcache depends foo --recurse
118 testsuccessequal 'foo
119 Depends: bar
120 Conflicts: <foobar>
121 Conflicts: <foobar:i386>
122 |Recommends: <cool>
123 Recommends: <cooler>
124 bar
125 Depends: bar
126 Breaks: foo
127 Breaks: <foo:i386>
128 Replaces: foo
129 Replaces: <foo:i386>
130 <foobar>
131 <foobar:i386>
132 <cool>
133 <cooler>
134 <foo:i386>' aptcache depends foo --recurse --implicit
135 testsuccessequal 'foo
136 Depends: bar
137 bar
138 Depends: bar
139 Replaces: foo' aptcache depends foo --recurse --important --replaces
140 testsuccessequal 'foo
141 Depends: bar
142 bar
143 Depends: bar
144 Replaces: foo
145 Replaces: <foo:i386>
146 <foo:i386>' aptcache depends foo --recurse --important --replaces --implicit
147 testsuccessequal 'bar
148 Depends: bar
149 Breaks: foo
150 Replaces: foo' aptcache depends bar
151 testsuccessequal 'bar
152 Depends: bar
153 Breaks: foo
154 Breaks: <foo:i386>
155 Replaces: foo
156 Replaces: <foo:i386>' aptcache depends bar --implicit
157 testsuccessequal 'specific
158 Depends: <bar:i386>
159 Depends: specific:amd64
160 Breaks: foo:amd64
161 Replaces: <foo:i386>' aptcache depends specific
162 testsuccessequal 'specific
163 Depends: <bar:i386>
164 Depends: specific:amd64
165 Breaks: foo:amd64
166 Replaces: <foo:i386>' aptcache depends specific --implicit
167
168 ## rdpends
169
170 testsuccessequal 'foo
171 Reverse Depends:
172 bar
173 specific
174 bar' aptcache rdepends foo
175 testsuccessequal 'foo
176 Reverse Depends:
177 Breaks: bar
178 Breaks: specific
179 Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
180 testsuccessequal 'foo
181 Reverse Depends:
182 Breaks: bar (<< 1)
183 Breaks: specific (<< 1)
184 Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
185 testsuccessequal 'foo
186 Reverse Depends:
187 Breaks: bar (<< 1)
188 Breaks: specific (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks