]> git.saurik.com Git - apt.git/blob - test/integration/test-apt-cache
various small additional tests and testcases
[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
20 setupaptarchive
21
22 # dpkg is installed by our framework
23 testdpkginstalled 'dpkg'
24 testempty aptcache unmet dpkg
25
26 # FIXME: Find some usecase for unmet as it seems kinda useless/broken
27 #testsuccess aptcache unmet
28 #testsuccess aptcache unmet foo
29
30 # not too useful to test, but makes coverage green…
31 testsuccess aptcache stats
32 cp rootdir/tmp/testsuccess.output stats.output
33 testsuccess test -s stats.output
34 testsuccess aptcache xvcg foo
35 cp rootdir/tmp/testsuccess.output xvcg.output
36 testsuccess test -s xvcg.output
37 testsuccess aptcache dotty foo
38 cp rootdir/tmp/testsuccess.output dotty.output
39 testsuccess test -s dotty.output
40 # for this, even the sourcecode says it is useless (expect debugging)
41 testsuccess aptcache dump
42 cp rootdir/tmp/testsuccess.output dump.output
43 testsuccess test -s dump.output
44
45 testequal 'dpkg
46 bar
47 fancy
48 foo' aptcache pkgnames
49 testequal 'bar' aptcache pkgnames bar
50 testequal 'fancy
51 foo' aptcache pkgnames f
52
53 testequal " foo | 1 | file:$(readlink -f .)/aptarchive/ unstable/main amd64 Packages" aptcache madison foo
54
55 ### depends
56
57 testequal 'foo
58 Depends: bar
59 |Recommends: <cool>
60 Recommends: <cooler>
61 Conflicts: <foobar>
62 Conflicts: <foobar:i386>' aptcache depends foo
63 testequal 'foo
64 Depends: bar
65 Recommends: <cool>
66 Conflicts: <foobar>
67 Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowOnlyFirstOr=1
68 testequal 'foo
69 Depends: bar
70 |Recommends: <cool> (>= 2)
71 Recommends: <cooler> (<< 5)
72 Conflicts: <foobar>
73 Conflicts: <foobar:i386>' aptcache depends foo -o APT::Cache::ShowVersion=1
74 testequal 'foo
75 Depends: bar
76 Conflicts: <foobar>
77 Conflicts: <foobar:i386>' aptcache depends foo --no-recommends
78 testequal 'foo
79 Depends: bar' aptcache depends foo --important
80 testequal 'foo
81 Conflicts: <foobar>
82 Conflicts: <foobar:i386>' aptcache depends foo --important --no-depends --conflicts
83 testequal 'foo
84 Depends: bar
85 |Recommends: <cool>
86 Recommends: <cooler>
87 Conflicts: <foobar>
88 Conflicts: <foobar:i386>
89 bar
90 Depends: bar
91 Breaks: foo
92 Breaks: <foo:i386>
93 Replaces: foo
94 Replaces: <foo:i386>
95 <cool>
96 <cooler>
97 <foobar>
98 <foobar:i386>
99 <foo:i386>' aptcache depends foo --recurse
100 testequal 'foo
101 Depends: bar
102 bar
103 Depends: bar
104 Replaces: foo
105 Replaces: <foo:i386>
106 <foo:i386>' aptcache depends foo --recurse --important --replaces
107
108 ## rdpends
109
110 testequal 'foo
111 Reverse Depends:
112 bar
113 bar' aptcache rdepends foo
114 testequal 'foo
115 Reverse Depends:
116 Replaces: bar
117 Breaks: bar' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1
118 testequal 'foo
119 Reverse Depends:
120 Replaces: bar (<< 1)
121 Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1
122 testequal 'foo
123 Reverse Depends:
124 Breaks: bar (<< 1)' aptcache rdepends foo -o APT::Cache::ShowDependencyType=1 -o APT::Cache::ShowVersion=1 --important --breaks