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