summaryrefslogtreecommitdiffstats
path: root/tests/uploaders.test
blob: 6260996cd7f0b7cc1fd52cdab8f55ca859452ad7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
set -u
. "$TESTSDIR"/test.inc

mkdir -p conf
cat > conf/distributions <<EOF
Codename: test1
Components: main
Architectures: source coal
Uploaders: uploaders1

Codename: test2
Components: main
Architectures: source coal
Uploaders: uploaders2
EOF

checknonetakes() {
testrun - -b . __checkuploaders test1 test2 < "$1" 3<<EOF
stdout
*='testpackage' would NOT have been accepted by any of the distributions selected.
EOF
}

check1takes() {
testrun - -b . __checkuploaders test1 test2 < "$1" 3<<EOF
stdout
*='testpackage' would have been accepted by 'test1'
EOF
}
check2takes() {
testrun - -b . __checkuploaders test1 test2 < "$1" 3<<EOF
stdout
*='testpackage' would have been accepted by 'test2'
EOF
}

cat > descr1 <<EOF
source testpackage
architecture source
EOF

testrun - -b . __checkuploaders test1 test2 < descr1 3<<EOF
*=Error opening './conf/uploaders1': No such file or directory
-v0*=There have been errors!
returns 254
EOF

cat > conf/uploaders1 <<EOF
EOF

testrun - -b . __checkuploaders test1 test2 < descr1 3<<EOF
*=Error opening './conf/uploaders2': No such file or directory
-v0*=There have been errors!
returns 254
EOF

cat > conf/uploaders2 <<EOF
include uploaders2
EOF

testrun - -b . __checkuploaders test1 test2 < descr1 3<<EOF
*=./conf/uploaders2:1:0: Too deeply nested include directives (> 100). Built some recursion?
*=included from './conf/uploaders2' line 1
-v0*=There have been errors!
returns 255
EOF

cat > conf/uploaders2 <<EOF
allow source 'testpackage' by unsigned
EOF

check2takes descr1

cat > descrbad <<EOF
unknowncommand
EOF

testrun - -b . __checkuploaders test1 test2 < descrbad 3<<EOF
*=Unparseable line 'unknowncommand'
-v0*=There have been errors!
returns 255
EOF

cat > descrbad <<EOF
architecture source
EOF

testrun - -b . __checkuploaders test1 test2 < descrbad 3<<EOF
*=No source name specified!
-v0*=There have been errors!
returns 255
EOF

cat > descres <<EOF
source testpackage
architecture source
signature e0000000000000000
EOF
cat > descrs <<EOF
source testpackage
architecture source
signature 0000000000000000
EOF

checknonetakes descres
checknonetakes descrs

echo "now test2 accepts all valid signatures for testpackage"
cat >> conf/uploaders2 <<EOF
allow source 'testpackage' by any key
EOF

check2takes descrs
checknonetakes descres

cat >>conf/uploaders1 <<EOF
group test
EOF
testrun - -b . __checkuploaders test1 test2 < descrbad 3<<EOF
*=./conf/uploaders1:1:11: missing 'add', 'contains', 'unused' or 'empty' keyword.
-v0*=There have been errors!
returns 255
EOF

cat >conf/uploaders1 <<EOF
group test add
EOF

testrun - -b . __checkuploaders test1 test2 < descrbad 3<<EOF
*=./conf/uploaders1:1:15: key id or fingerprint expected!
-v0*=There have been errors!
returns 255
EOF

cat >conf/uploaders1 <<EOF
group test add 00000000
EOF

testrun - -b . __checkuploaders test1 test2 < descres 3<<EOF
-v0*=./conf/uploaders1:1: Warning: group 'test' gets members but is not used in any rule
stdout
*='testpackage' would NOT have been accepted by any of the distributions selected.
EOF

cat >>conf/uploaders1 <<EOF
group test unused
EOF

checknonetakes descres

cat >>conf/uploaders1 <<EOF
allow * by group test
EOF

testrun - -b . __checkuploaders test1 test2 < descrbad 3<<EOF
*=./conf/uploaders1:3: cannot use group 'test' marked as unused!
*=./conf/uploaders1:2: here it was marked as unused.
-v0*=There have been errors!
returns 255
EOF

cat >conf/uploaders1 <<EOF
group test add 00000000
group test unused
allow * by group tset
EOF

testrun - -b . __checkuploaders test1 test2 < descres 3<<EOF
-v0*=./conf/uploaders1:3: Warning: group 'tset' gets used but never gets any members
stdout
*='testpackage' would NOT have been accepted by any of the distributions selected.
EOF

cat >>conf/uploaders1 <<EOF
group tset contains test
EOF

testrun - -b . __checkuploaders test1 test2 < descres 3<<EOF
*=./conf/uploaders1:4: cannot use group 'test' marked as unused!
*=./conf/uploaders1:2: here it got marked as unused.
-v0*=There have been errors!
returns 255
EOF

sed -e '/unused/d' -i conf/uploaders1

check1takes descrs
checknonetakes descres

cat >>conf/uploaders1 <<EOF
group test contains indirection
group indirection contains test
EOF

testrun - -b . __checkuploaders test1 test2 < descres 3<<EOF
*=./conf/uploaders1:5: cannot add group 'test' to group 'indirection' as the later is already member of the former!
-v0*=There have been errors!
returns 255
EOF

cat >conf/uploaders1 <<EOF
group group add 76543210
group foo add 00000000
group bla contains group
group blub contains foo
group g5 contains foo
group g5 unused
group g6 contains foo
group g6 unused
group g7 contains foo
group g7 unused
group g8 contains foo
group g8 unused
group g9 contains foo
group g9 unused
group g10 contains foo
group g10 unused
group g11 contains foo
group g11 unused
group g12 contains foo
group g12 unused
group g13 contains foo
group g13 unused
group g14 contains foo
group g14 unused
group g15 contains foo
group g15 unused
group g16 contains foo
group g16 unused
group g17 contains foo
group g17 unused
group g18 contains foo
group g18 unused
group g19 contains foo
group g19 unused
group g20 contains foo
group g20 unused
group g21 contains foo
group g21 unused
allow * by group bla
allow architectures contain 'coal' by group blub
EOF

check2takes descrs
sed -e 's/0000000000000000/fedcba9876543210/g' descrs >> descr2
sed -e 's/0000000000000000/fedcba9876542210/g' descrs >> descr3
echo "architecture coal" >> descrs
check1takes descrs
check1takes descr2
check2takes descr3

rm -r conf descr*
testsuccess