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