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