]> git.saurik.com Git - apt.git/blame - test/integration/test-apt-mark
rred: truncate result file before writing to it
[apt.git] / test / integration / test-apt-mark
CommitLineData
374f8492
DK
1#!/bin/sh
2set -e
3
3abb6a6a
DK
4TESTDIR="$(readlink -f "$(dirname "$0")")"
5. "$TESTDIR/framework"
374f8492
DK
6setupenvironment
7configarchitecture 'amd64' 'i386'
8
9insertpackage 'unstable' 'bar' 'amd64,i386' '1'
10insertpackage 'unstable' 'uninstalled' 'all' '1'
11insertpackage 'unstable' 'uninstalled-native' 'amd64' '1'
12
13insertinstalledpackage 'foo' 'all' '1'
14insertinstalledpackage 'bar' 'amd64' '1'
15
16setupaptarchive
17
18# dpkg is "installed" by our test framework
19testdpkginstalled dpkg
20
21testnoautopkg() {
22 testempty aptmark showauto
87d6947d 23 testempty aptcache -q=1 showauto
25b86db1 24 testsuccessequal 'bar
374f8492
DK
25dpkg
26foo' aptmark showmanual
25b86db1 27 testsuccessequal 'bar
374f8492
DK
28foo' aptmark showmanual bar foo uninstalled
29}
081c9d44 30testfooisauto() {
25b86db1 31 testsuccessequal 'foo' aptmark showauto
87d6947d 32 testsuccessequal 'foo' aptcache -q=1 showauto
25b86db1 33 testsuccessequal 'foo' aptmark showauto foo
87d6947d 34 testsuccessequal 'foo' aptcache -q=1 showauto foo
25b86db1 35 testsuccessequal 'bar
374f8492 36dpkg' aptmark showmanual
25b86db1 37 testsuccessequal 'bar' aptmark showmanual bar
081c9d44
DK
38}
39testmarkonpkgasauto() {
87d6947d 40 testsuccess $1 -q=1 $2 foo
081c9d44 41 testfooisauto
87d6947d 42 testsuccess $1 -q=1 $2 foo
081c9d44 43 testfooisauto
374f8492 44
87d6947d 45 testsuccess $1 -q=1 $3 foo
081c9d44 46 testnoautopkg
87d6947d 47 testsuccess $1 -q=1 $3 foo
374f8492
DK
48 testnoautopkg
49}
50
25b86db1
DK
51testfailureequal 'E: No packages found' aptmark auto
52testfailureequal 'E: No packages found' aptmark manual
374f8492
DK
53
54testnoautopkg
081c9d44
DK
55testmarkonpkgasauto 'aptmark' 'auto' 'manual'
56testmarkonpkgasauto 'aptmark' 'markauto' 'unmarkauto'
57testmarkonpkgasauto 'aptget' 'markauto' 'unmarkauto'
374f8492
DK
58
59testnoholdpkg() {
60 testempty aptmark showhold
61 testempty aptmark showholds # typical "typo"
62 testempty aptmark showhold dpkg
63 testempty aptmark showholds dpkg
64}
081c9d44 65testpkgonhold() {
25b86db1
DK
66 testsuccessequal "$1" aptmark showhold
67 testsuccessequal "$1" aptmark showholds
68 testsuccessequal "$1" aptmark showhold $1
69 testsuccessequal "$1" aptmark showholds $1
081c9d44
DK
70}
71testmarkonepkgashold() {
72 testsuccess aptmark hold $1
73 testpkgonhold $1
74 testsuccess aptmark hold $1
75 testpkgonhold $1
76 testsuccess aptmark unhold $1
77 testnoholdpkg
374f8492
DK
78 testsuccess aptmark unhold $1
79 testnoholdpkg
80}
81
25b86db1
DK
82testfailureequal 'E: No packages found' aptmark hold
83testfailureequal 'E: No packages found' aptmark unhold
374f8492
DK
84
85testnoholdpkg
86testmarkonepkgashold 'foo'
87testmarkonepkgashold 'bar'
1d838084
DK
88
89msgtest 'dpkg supports --merge-avail via' 'stdin'
90if dpkg --merge-avail - < /dev/null >/dev/null 2>&1; then
91 msgpass
92else
93 msgskip 'dpkg version too old'
94 exit 0
95fi
96
374f8492
DK
97testmarkonepkgashold 'uninstalled'
98testmarkonepkgashold 'uninstalled-native'
99
25b86db1
DK
100testsuccessequal 'uninstalled set on hold.' aptmark hold uninstalled
101testsuccessequal 'uninstalled-native set on hold.' aptmark hold uninstalled-native
b49068c5
DK
102#FIXME: holds on uninstalled packages are not persistent in dpkg
103testsuccessequal 'Reading package lists...
104Building dependency tree...
105Reading state information...
106The following NEW packages will be installed:
107 uninstalled uninstalled-native
108The following held packages will be changed:
109 uninstalled-native
1100 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
111Inst uninstalled (1 unstable [all])
112Inst uninstalled-native (1 unstable [amd64])
113Conf uninstalled (1 unstable [all])
114Conf uninstalled-native (1 unstable [amd64])' aptget install uninstalled uninstalled-native -s
64e3414e
DK
115testsuccess aptmark unhold uninstalled uninstalled-native
116
117testselections() {
118 testsuccess aptmark hold "$1"
119 testsuccessequal "$1" aptmark showholds "$1"
120 testsuccess aptmark unhold "$1"
121 testsuccessequal "$1" aptmark showinstalls "$1"
122 testsuccess aptmark hold "$1"
123 testsuccessequal "$1" aptmark showholds "$1"
124 testsuccess aptmark install "$1"
125 testsuccessequal "$1" aptmark showinstalls "$1"
126 testsuccess aptmark remove "$1"
127 testsuccessequal "$1" aptmark showremoves "$1"
128 testsuccess aptmark purge "$1"
129 testsuccessequal "$1" aptmark showpurges "$1"
130}
131testselections 'foo'
132testselections 'bar'
133
134testsuccessequal 'Reading package lists...
135Building dependency tree...
136Reading state information...
137The following packages will be REMOVED:
138 bar* foo*
1390 upgraded, 0 newly installed, 2 to remove and 0 not upgraded.
140Purg bar [1]
141Purg foo [1]' aptget dselect-upgrade -s
142
143testuninstalledselections() {
144 testsuccess aptmark hold "$1"
145 testsuccessequal "$1" aptmark showholds "$1"
146 testsuccess aptmark unhold "$1"
147 testsuccessequal "$1" aptmark showremoves "$1"
148 testsuccess aptmark hold "$1"
149 testsuccessequal "$1" aptmark showholds "$1"
150 testsuccess aptmark install "$1"
151 testsuccessequal "$1" aptmark showinstalls "$1"
152}
153testuninstalledselections 'uninstalled'
154testuninstalledselections 'uninstalled-native'