]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-cache
1d90eed5cb280ecc6638fd6e76b7b8a7b2315633
[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 |Recommends: <cool>
70 Recommends: <cooler>' aptcache depends foo --implicit
71 testsuccessequal 'foo
72 Depends: bar
73 Conflicts: <foobar>
74 Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
75 testsuccessequal 'foo
76 Depends: bar
77 Conflicts: <foobar>
78 Recommends: <cool>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1 --implicit
79 testsuccessequal 'foo
80 Depends: bar
81 Conflicts: <foobar>
82 |Recommends: <cool> (>= 2)
83 Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1
84 testsuccessequal 'foo
85 Depends: bar
86 Conflicts: <foobar>
87 |Recommends: <cool> (>= 2)
88 Recommends: <cooler> (<< 5)' aptcache depends foo -o APT::Cache::ShowVersion=1 --implicit
89 testsuccessequal 'foo
90 Depends: bar
91 Conflicts: <foobar>' aptcache depends foo --no-recommends
92 testsuccessequal 'foo
93 Depends: bar
94 Conflicts: <foobar>' aptcache depends foo --no-recommends --implicit
95 testsuccessequal 'foo
96 Depends: bar' aptcache depends foo --important --implicit
97 testsuccessequal 'foo
98 Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts
99 testsuccessequal 'foo
100 Conflicts: <foobar>' aptcache depends foo --important --no-depends --conflicts --implicit
101 testsuccessequal 'foo
102 Depends: bar
103 Conflicts: <foobar>
104 |Recommends: <cool>
105 Recommends: <cooler>
106 bar
107 Depends: bar
108 Breaks: foo
109 Replaces: foo
110 <foobar>
111 <cool>
112 <cooler>' aptcache depends foo --recurse
113 testsuccessequal 'foo
114 Depends: bar
115 Conflicts: <foobar>
116 |Recommends: <cool>
117 Recommends: <cooler>
118 bar
119 Depends: bar
120 Breaks: foo
121 Replaces: foo
122 Breaks: <foo:i386>
123 Replaces: <foo:i386>
124 <foobar>
125 <cool>
126 <cooler>
127 <foo:i386>' aptcache depends foo --recurse --implicit
128 testsuccessequal 'foo
129 Depends: bar
130 bar
131 Depends: bar
132 Replaces: foo' aptcache depends foo --recurse --important --replaces
133 testsuccessequal 'foo
134 Depends: bar
135 bar
136 Depends: bar
137 Replaces: foo
138 Replaces: <foo:i386>
139 <foo:i386>' aptcache depends foo --recurse --important --replaces --implicit
140 testsuccessequal 'bar
141 Depends: bar
142 Breaks: foo
143 Replaces: foo' aptcache depends bar
144 testsuccessequal 'bar
145 Depends: bar
146 Breaks: foo
147 Replaces: foo
148 Breaks: <foo:i386>
149 Replaces: <foo:i386>' aptcache depends bar --implicit
150 testsuccessequal 'specific
151 Depends: <bar:i386>
152 Depends: specific:amd64
153 Breaks: foo:amd64
154 Replaces: <foo:i386>' aptcache depends specific
155 testsuccessequal 'specific
156 Depends: <bar:i386>
157 Depends: specific:amd64
158 Breaks: foo:amd64
159 Replaces: <foo:i386>' aptcache depends specific --implicit
160
161 ## rdpends
162
163 testsuccessequal 'foo
164 Reverse Depends:
165 bar
166 specific
167 bar' aptcache rdepends foo
168 testsuccessequal 'foo
169 Reverse Depends:
170 Breaks: bar
171 Breaks: specific
172 Replaces: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
173 testsuccessequal 'foo
174 Reverse Depends:
175 Breaks: bar (<< 1)
176 Breaks: specific (<< 1)
177 Replaces: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
178 testsuccessequal 'foo
179 Reverse Depends:
180 Breaks: bar (<< 1)
181 Breaks: specific (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks