]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/units/testsuite-15.sh
Merge pull request #19248 from keszybz/make-tests-test
[thirdparty/systemd.git] / test / units / testsuite-15.sh
CommitLineData
fbc42f13 1#! /bin/bash
fbc42f13
FB
2set -e
3set -x
4
5_clear_service () {
cc5549ca
ZJS
6 systemctl stop $1.service 2>/dev/null || :
7 rm -f /{etc,run,usr/lib}/systemd/system/$1.service
8 rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.d
9 rm -fr /{etc,run,usr/lib}/systemd/system/$1.service.{wants,requires}
4e2ac45a
ZJS
10 if [[ $1 == *@ ]]; then
11 systemctl stop $1*.service 2>/dev/null || :
12 rm -f /{etc,run,usr/lib}/systemd/system/$1*.service
13 rm -fr /{etc,run,usr/lib}/systemd/system/$1*.service.d
14 rm -fr /{etc,run,usr/lib}/systemd/system/$1*.service.{wants,requires}
15 fi
fbc42f13
FB
16}
17
18clear_services () {
cc5549ca
ZJS
19 for u in $*; do
20 _clear_service $u
21 done
22 systemctl daemon-reload
fbc42f13
FB
23}
24
25create_service () {
cc5549ca 26 clear_services $1
fbc42f13 27
cc5549ca 28 cat >/etc/systemd/system/$1.service<<EOF
fbc42f13
FB
29[Unit]
30Description=$1 unit
31
32[Service]
33ExecStart=/bin/sleep 100000
34EOF
cc5549ca
ZJS
35 mkdir -p /{etc,run,usr/lib}/systemd/system/$1.service.d
36 mkdir -p /etc/systemd/system/$1.service.{wants,requires}
37 mkdir -p /run/systemd/system/$1.service.{wants,requires}
38 mkdir -p /usr/lib/systemd/system/$1.service.{wants,requires}
fbc42f13
FB
39}
40
41create_services () {
cc5549ca
ZJS
42 for u in $*; do
43 create_service $u
44 done
fbc42f13
FB
45}
46
47check_ok () {
cc5549ca 48 [ $# -eq 3 ] || return
fbc42f13 49
cc5549ca
ZJS
50 x="$(systemctl show --value -p $2 $1)"
51 case "$x" in
52 *$3*) return 0 ;;
53 *) return 1 ;;
54 esac
fbc42f13
FB
55}
56
57check_ko () {
cc5549ca 58 ! check_ok "$@"
fbc42f13
FB
59}
60
61test_basic_dropins () {
cc5549ca
ZJS
62 echo "Testing basic dropins..."
63
64 echo "*** test a wants b wants c"
2c7519c0
ZJS
65 create_services test15-a test15-b test15-c
66 ln -s ../test15-b.service /etc/systemd/system/test15-a.service.wants/
67 ln -s ../test15-c.service /etc/systemd/system/test15-b.service.wants/
68 check_ok test15-a Wants test15-b.service
69 check_ok test15-b Wants test15-c.service
cc5549ca
ZJS
70
71 echo "*** test a wants,requires b"
2c7519c0
ZJS
72 create_services test15-a test15-b test15-c
73 ln -s ../test15-b.service /etc/systemd/system/test15-a.service.wants/
74 ln -s ../test15-b.service /etc/systemd/system/test15-a.service.requires/
75 check_ok test15-a Wants test15-b.service
76 check_ok test15-a Requires test15-b.service
cc5549ca
ZJS
77
78 echo "*** test a wants nonexistent"
2c7519c0
ZJS
79 create_service test15-a
80 ln -s ../nonexistent.service /etc/systemd/system/test15-a.service.wants/
81 check_ok test15-a Wants nonexistent.service
82 systemctl start test15-a
83 systemctl stop test15-a
cc5549ca
ZJS
84
85 echo "*** test a requires nonexistent"
2c7519c0 86 ln -sf ../nonexistent.service /etc/systemd/system/test15-a.service.requires/
cc5549ca 87 systemctl daemon-reload
2c7519c0 88 check_ok test15-a Requires nonexistent.service
cc5549ca
ZJS
89
90 # 'b' is already loaded when 'c' pulls it in via a dropin.
91 echo "*** test a,c require b"
2c7519c0
ZJS
92 create_services test15-a test15-b test15-c
93 ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.requires/
94 ln -sf ../test15-b.service /etc/systemd/system/test15-c.service.requires/
95 systemctl start test15-a
96 check_ok test15-c Requires test15-b.service
97 systemctl stop test15-a test15-b
cc5549ca
ZJS
98
99 # 'b' is already loaded when 'c' pulls it in via an alias dropin.
100 echo "*** test a wants alias"
2c7519c0
ZJS
101 create_services test15-a test15-b test15-c
102 ln -sf test15-c.service /etc/systemd/system/test15-c1.service
103 ln -sf ../test15-c.service /etc/systemd/system/test15-a.service.wants/
104 ln -sf ../test15-c1.service /etc/systemd/system/test15-b.service.wants/
105 systemctl start test15-a
106 check_ok test15-a Wants test15-c.service
107 check_ok test15-b Wants test15-c.service
108 systemctl stop test15-a test15-c
cc5549ca 109
3e1db806 110 echo "*** test service.d/ top level drop-in"
2c7519c0
ZJS
111 create_services test15-a test15-b
112 check_ko test15-a ExecCondition "/bin/echo a"
113 check_ko test15-b ExecCondition "/bin/echo b"
3e1db806
AZ
114 mkdir -p /usr/lib/systemd/system/service.d
115 cat >/usr/lib/systemd/system/service.d/override.conf <<EOF
d2724678
AZ
116[Service]
117ExecCondition=/bin/echo %n
118EOF
1aa0f384 119 systemctl daemon-reload
2c7519c0
ZJS
120 check_ok test15-a ExecCondition "/bin/echo test15-a"
121 check_ok test15-b ExecCondition "/bin/echo test15-b"
3e1db806 122 rm -rf /usr/lib/systemd/system/service.d
d2724678 123
2c7519c0 124 clear_services test15-a test15-b test15-c
fbc42f13
FB
125}
126
3b5ab021
ZJS
127test_linked_units () {
128 echo "Testing linked units..."
129 echo "*** test linked unit (same basename)"
130
131 create_service test15-a
132 mv /etc/systemd/system/test15-a.service /
133 ln -s /test15-a.service /etc/systemd/system/
134 ln -s test15-a.service /etc/systemd/system/test15-b.service
135
136 check_ok test15-a Names test15-a.service
137 check_ok test15-a Names test15-b.service
138
139 echo "*** test linked unit (cross basename)"
140
141 mv /test15-a.service /test15-a@.scope
142 ln -fs /test15-a@.scope /etc/systemd/system/test15-a.service
143 systemctl daemon-reload
144
145 check_ok test15-a Names test15-a.service
146 check_ok test15-a Names test15-b.service
b903f16c
ZJS
147 check_ko test15-a Names test15-a@ # test15-a@.scope is the symlink target.
148 # Make sure it is completely ignored.
3b5ab021
ZJS
149
150 rm /test15-a@.scope
151 clear_services test15-a test15-b
152}
153
f5dd6e50
GGM
154test_hierarchical_dropins () {
155 echo "Testing hierarchical dropins..."
156 echo "*** test service.d/ top level drop-in"
157 create_services a-b-c
158 check_ko a-b-c ExecCondition "/bin/echo service.d"
159 check_ko a-b-c ExecCondition "/bin/echo a-.service.d"
160 check_ko a-b-c ExecCondition "/bin/echo a-b-.service.d"
161 check_ko a-b-c ExecCondition "/bin/echo a-b-c.service.d"
162
163 for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
164 mkdir -p /usr/lib/systemd/system/$dropin
165 echo "
166[Service]
167ExecCondition=/bin/echo $dropin
0ee99483 168 " >/usr/lib/systemd/system/$dropin/override.conf
1aa0f384 169 systemctl daemon-reload
f5dd6e50
GGM
170 check_ok a-b-c ExecCondition "/bin/echo $dropin"
171 done
172 for dropin in service.d a-.service.d a-b-.service.d a-b-c.service.d; do
173 rm -rf /usr/lib/systemd/system/$dropin
174 done
175
176 clear_services a-b-c
177}
178
fbc42f13 179test_template_dropins () {
cc5549ca 180 echo "Testing template dropins..."
fbc42f13 181
cc5549ca 182 create_services foo bar@ yup@
fbc42f13 183
54f44034
ZJS
184 # Declare some deps to check if the body was loaded
185 cat >>/etc/systemd/system/bar@.service <<EOF
186[Unit]
187After=bar-template-after.device
188EOF
189
190 cat >>/etc/systemd/system/yup@.service <<EOF
191[Unit]
192After=yup-template-after.device
193EOF
194
cc5549ca
ZJS
195 ln -s /etc/systemd/system/bar@.service /etc/systemd/system/foo.service.wants/bar@1.service
196 check_ok foo Wants bar@1.service
fbc42f13 197
54f44034
ZJS
198 echo "*** test bar-alias@.service→bar@.service, but instance symlinks point to yup@.service ***"
199 ln -s bar@.service /etc/systemd/system/bar-alias@.service
200 ln -s bar@1.service /etc/systemd/system/bar-alias@1.service
201 ln -s yup@.service /etc/systemd/system/bar-alias@2.service
202 ln -s yup@3.service /etc/systemd/system/bar-alias@3.service
203
204 # create some dropin deps
205 mkdir -p /etc/systemd/system/bar@{,0,1,2,3}.service.requires/
206 mkdir -p /etc/systemd/system/yup@{,0,1,2,3}.service.requires/
207 mkdir -p /etc/systemd/system/bar-alias@{,0,1,2,3}.service.requires/
208
209 ln -s ../bar-template-requires.device /etc/systemd/system/bar@.service.requires/
210 ln -s ../bar-0-requires.device /etc/systemd/system/bar@0.service.requires/
211 ln -s ../bar-1-requires.device /etc/systemd/system/bar@1.service.requires/
212 ln -s ../bar-2-requires.device /etc/systemd/system/bar@2.service.requires/
213 ln -s ../bar-3-requires.device /etc/systemd/system/bar@3.service.requires/
214
215 ln -s ../yup-template-requires.device /etc/systemd/system/yup@.service.requires/
216 ln -s ../yup-0-requires.device /etc/systemd/system/yup@0.service.requires/
217 ln -s ../yup-1-requires.device /etc/systemd/system/yup@1.service.requires/
218 ln -s ../yup-2-requires.device /etc/systemd/system/yup@2.service.requires/
219 ln -s ../yup-3-requires.device /etc/systemd/system/yup@3.service.requires/
220
221 ln -s ../bar-alias-template-requires.device /etc/systemd/system/bar-alias@.service.requires/
222 ln -s ../bar-alias-0-requires.device /etc/systemd/system/bar-alias@0.service.requires/
223 ln -s ../bar-alias-1-requires.device /etc/systemd/system/bar-alias@1.service.requires/
224 ln -s ../bar-alias-2-requires.device /etc/systemd/system/bar-alias@2.service.requires/
225 ln -s ../bar-alias-3-requires.device /etc/systemd/system/bar-alias@3.service.requires/
226
227 systemctl daemon-reload
228
229 echo '*** bar@0 is aliased by bar-alias@0 ***'
230 systemctl show -p Names,Requires bar@0
231 systemctl show -p Names,Requires bar-alias@0
232 check_ok bar@0 Names bar@0
e8630e69 233 check_ok bar@0 Names bar-alias@0
54f44034
ZJS
234
235 check_ok bar@0 After bar-template-after.device
236
237 check_ok bar@0 Requires bar-0-requires.device
e8630e69 238 check_ok bar@0 Requires bar-alias-0-requires.device
54f44034 239 check_ok bar@0 Requires bar-template-requires.device
e8630e69 240 check_ok bar@0 Requires bar-alias-template-requires.device
54f44034
ZJS
241 check_ko bar@0 Requires yup-template-requires.device
242
243 check_ok bar-alias@0 After bar-template-after.device
244
245 check_ok bar-alias@0 Requires bar-0-requires.device
246 check_ok bar-alias@0 Requires bar-alias-0-requires.device
247 check_ok bar-alias@0 Requires bar-template-requires.device
248 check_ok bar-alias@0 Requires bar-alias-template-requires.device
249 check_ko bar-alias@0 Requires yup-template-requires.device
250 check_ko bar-alias@0 Requires yup-0-requires.device
251
252 echo '*** bar@1 is aliased by bar-alias@1 ***'
253 systemctl show -p Names,Requires bar@1
254 systemctl show -p Names,Requires bar-alias@1
255 check_ok bar@1 Names bar@1
e8630e69 256 check_ok bar@1 Names bar-alias@1
54f44034
ZJS
257
258 check_ok bar@1 After bar-template-after.device
259
260 check_ok bar@1 Requires bar-1-requires.device
e8630e69 261 check_ok bar@1 Requires bar-alias-1-requires.device
54f44034
ZJS
262 check_ok bar@1 Requires bar-template-requires.device
263 # See https://github.com/systemd/systemd/pull/13119#discussion_r308145418
e8630e69 264 check_ok bar@1 Requires bar-alias-template-requires.device
54f44034
ZJS
265 check_ko bar@1 Requires yup-template-requires.device
266 check_ko bar@1 Requires yup-1-requires.device
267
268 check_ok bar-alias@1 After bar-template-after.device
269
270 check_ok bar-alias@1 Requires bar-1-requires.device
271 check_ok bar-alias@1 Requires bar-alias-1-requires.device
272 check_ok bar-alias@1 Requires bar-template-requires.device
273 check_ok bar-alias@1 Requires bar-alias-template-requires.device
274 check_ko bar-alias@1 Requires yup-template-requires.device
275 check_ko bar-alias@1 Requires yup-1-requires.device
276
277 echo '*** bar-alias@2 aliases yup@2, bar@2 is independent ***'
278 systemctl show -p Names,Requires bar@2
279 systemctl show -p Names,Requires bar-alias@2
280 check_ok bar@2 Names bar@2
281 check_ko bar@2 Names bar-alias@2
282
283 check_ok bar@2 After bar-template-after.device
284
285 check_ok bar@2 Requires bar-2-requires.device
286 check_ko bar@2 Requires bar-alias-2-requires.device
287 check_ok bar@2 Requires bar-template-requires.device
288 check_ko bar@2 Requires bar-alias-template-requires.device
289 check_ko bar@2 Requires yup-template-requires.device
290 check_ko bar@2 Requires yup-2-requires.device
291
292 check_ko bar-alias@2 After bar-template-after.device
293
294 check_ko bar-alias@2 Requires bar-2-requires.device
295 check_ok bar-alias@2 Requires bar-alias-2-requires.device
296 check_ko bar-alias@2 Requires bar-template-requires.device
297 check_ok bar-alias@2 Requires bar-alias-template-requires.device
298 check_ok bar-alias@2 Requires yup-template-requires.device
299 check_ok bar-alias@2 Requires yup-2-requires.device
300
301 echo '*** bar-alias@3 aliases yup@3, bar@3 is independent ***'
302 systemctl show -p Names,Requires bar@3
303 systemctl show -p Names,Requires bar-alias@3
304 check_ok bar@3 Names bar@3
305 check_ko bar@3 Names bar-alias@3
306
307 check_ok bar@3 After bar-template-after.device
308
309 check_ok bar@3 Requires bar-3-requires.device
310 check_ko bar@3 Requires bar-alias-3-requires.device
311 check_ok bar@3 Requires bar-template-requires.device
312 check_ko bar@3 Requires bar-alias-template-requires.device
313 check_ko bar@3 Requires yup-template-requires.device
314 check_ko bar@3 Requires yup-3-requires.device
315
e8630e69 316 check_ko bar-alias@3 After bar-template-after.device
54f44034 317
e8630e69 318 check_ko bar-alias@3 Requires bar-3-requires.device
54f44034 319 check_ok bar-alias@3 Requires bar-alias-3-requires.device
e8630e69 320 check_ko bar-alias@3 Requires bar-template-requires.device
54f44034 321 check_ok bar-alias@3 Requires bar-alias-template-requires.device
e8630e69
ZJS
322 check_ok bar-alias@3 Requires yup-template-requires.device
323 check_ok bar-alias@3 Requires yup-3-requires.device
54f44034
ZJS
324
325 clear_services foo {bar,yup,bar-alias}@{,1,2,3}
fbc42f13
FB
326}
327
328test_alias_dropins () {
cc5549ca
ZJS
329 echo "Testing alias dropins..."
330
331 echo "*** test a wants b1 alias of b"
2c7519c0
ZJS
332 create_services test15-a test15-b
333 ln -sf test15-b.service /etc/systemd/system/test15-b1.service
334 ln -sf ../test15-b1.service /etc/systemd/system/test15-a.service.wants/
335 check_ok test15-a Wants test15-b.service
336 systemctl start test15-a
337 systemctl --quiet is-active test15-b
338 systemctl stop test15-a test15-b
339 rm /etc/systemd/system/test15-b1.service
340 clear_services test15-a test15-b
cc5549ca 341
e8630e69 342 # Check that dependencies don't vary.
cc5549ca 343 echo "*** test 2"
2c7519c0
ZJS
344 create_services test15-a test15-x test15-y
345 mkdir -p /etc/systemd/system/test15-a1.service.wants/
346 ln -sf test15-a.service /etc/systemd/system/test15-a1.service
347 ln -sf ../test15-x.service /etc/systemd/system/test15-a.service.wants/
348 ln -sf ../test15-y.service /etc/systemd/system/test15-a1.service.wants/
349 check_ok test15-a1 Wants test15-x.service # see [1]
350 check_ok test15-a1 Wants test15-y.service
351 systemctl start test15-a
352 check_ok test15-a1 Wants test15-x.service # see [2]
353 check_ok test15-a1 Wants test15-y.service
354 systemctl stop test15-a test15-x test15-y
355 rm /etc/systemd/system/test15-a1.service
356
357 clear_services test15-a test15-x test15-y
fbc42f13
FB
358}
359
360test_masked_dropins () {
cc5549ca
ZJS
361 echo "Testing masked dropins..."
362
2c7519c0 363 create_services test15-a test15-b
cc5549ca
ZJS
364
365 # 'b' is masked for both deps
366 echo "*** test a wants,requires b is masked"
2c7519c0
ZJS
367 ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
368 ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/test15-b.service
369 check_ko test15-a Wants test15-b.service
370 check_ko test15-a Requires test15-b.service
cc5549ca
ZJS
371
372 # 'a' wants 'b' and 'b' is masked at a lower level
373 echo "*** test a wants b, mask override"
2c7519c0
ZJS
374 ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.wants/test15-b.service
375 ln -sf /dev/null /usr/lib/systemd/system/test15-a.service.wants/test15-b.service
376 check_ok test15-a Wants test15-b.service
cc5549ca
ZJS
377
378 # 'a' wants 'b' and 'b' is masked at a higher level
379 echo "*** test a wants b, mask"
2c7519c0
ZJS
380 ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
381 ln -sf ../test15-b.service /usr/lib/systemd/system/test15-a.service.wants/test15-b.service
382 check_ko test15-a Wants test15-b.service
cc5549ca
ZJS
383
384 # 'a' is masked but has an override config file
385 echo "*** test a is masked but has an override"
2c7519c0
ZJS
386 create_services test15-a test15-b
387 ln -sf /dev/null /etc/systemd/system/test15-a.service
388 cat >/usr/lib/systemd/system/test15-a.service.d/override.conf <<EOF
67348e79 389[Unit]
2c7519c0 390After=test15-b.service
67348e79 391EOF
2c7519c0 392 check_ok test15-a UnitFileState masked
cc5549ca
ZJS
393
394 # 'b1' is an alias for 'b': masking 'b' dep should not influence 'b1' dep
395 echo "*** test a wants b, b1, and one is masked"
2c7519c0
ZJS
396 create_services test15-a test15-b
397 ln -sf test15-b.service /etc/systemd/system/test15-b1.service
398 ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
399 ln -sf ../test15-b1.service /usr/lib/systemd/system/test15-a.service.wants/test15-b1.service
400 systemctl cat test15-a
401 systemctl show -p Wants,Requires test15-a
402 systemctl cat test15-b1
403 systemctl show -p Wants,Requires test15-b1
404 check_ok test15-a Wants test15-b.service
405 check_ko test15-a Wants test15-b1.service # the alias does not show up in the list of units
406 rm /etc/systemd/system/test15-b1.service
cc5549ca
ZJS
407
408 # 'b1' is an alias for 'b': masking 'b1' should not influence 'b' dep
409 echo "*** test a wants b, alias dep is masked"
2c7519c0
ZJS
410 create_services test15-a test15-b
411 ln -sf test15-b.service /etc/systemd/system/test15-b1.service
412 ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b1.service
413 ln -sf ../test15-b.service /usr/lib/systemd/system/test15-a.service.wants/test15-b.service
414 check_ok test15-a Wants test15-b.service
415 check_ko test15-a Wants test15-b1.service # the alias does not show up in the list of units
416 rm /etc/systemd/system/test15-b1.service
cc5549ca
ZJS
417
418 # 'a' has Wants=b.service but also has a masking
419 # dropin 'b': 'b' should still be pulled in.
420 echo "*** test a wants b both ways"
2c7519c0
ZJS
421 create_services test15-a test15-b
422 ln -sf /dev/null /etc/systemd/system/test15-a.service.wants/test15-b.service
423 cat >/usr/lib/systemd/system/test15-a.service.d/wants-b.conf<<EOF
fbc42f13 424[Unit]
2c7519c0 425Wants=test15-b.service
fbc42f13 426EOF
2c7519c0 427 check_ok test15-a Wants test15-b.service
cc5549ca
ZJS
428
429 # mask a dropin that points to an nonexistent unit.
430 echo "*** test a wants nonexistent is masked"
2c7519c0
ZJS
431 create_services test15-a
432 ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/nonexistent.service
433 ln -sf ../nonexistent.service /usr/lib/systemd/system/test15-a.service.requires/
434 check_ko test15-a Requires nonexistent.service
cc5549ca
ZJS
435
436 # 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
437 # masked at a higher level.
438 echo "*** test a wants b is masked"
2c7519c0
ZJS
439 create_services test15-a test15-b test15-c
440 ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.requires/
441 ln -sf ../test15-b.service /run/systemd/system/test15-c.service.requires/
442 ln -sf /dev/null /etc/systemd/system/test15-c.service.requires/test15-b.service
443 systemctl start test15-a
444 check_ko test15-c Requires test15-b.service
445 systemctl stop test15-a test15-b
cc5549ca
ZJS
446
447 # 'b' is already loaded when 'c' pulls it in via a dropin but 'b' is
448 # masked at a lower level.
449 echo "*** test a requires b is masked"
2c7519c0
ZJS
450 create_services test15-a test15-b test15-c
451 ln -sf ../test15-b.service /etc/systemd/system/test15-a.service.requires/
452 ln -sf ../test15-b.service /etc/systemd/system/test15-c.service.requires/
453 ln -sf /dev/null /run/systemd/system/test15-c.service.requires/test15-b.service
454 systemctl start test15-a
455 check_ok test15-c Requires test15-b.service
456 systemctl stop test15-a test15-b
cc5549ca
ZJS
457
458 # 'a' requires 2 aliases of 'b' and one of them is a mask.
459 echo "*** test a requires alias of b, other alias masked"
2c7519c0
ZJS
460 create_services test15-a test15-b
461 ln -sf test15-b.service /etc/systemd/system/test15-b1.service
462 ln -sf test15-b.service /etc/systemd/system/test15-b2.service
463 ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/test15-b1.service
464 ln -sf ../test15-b1.service /run/systemd/system/test15-a.service.requires/
465 ln -sf ../test15-b2.service /usr/lib/systemd/system/test15-a.service.requires/
466 check_ok test15-a Requires test15-b
cc5549ca
ZJS
467
468 # Same as above but now 'b' is masked.
469 echo "*** test a requires alias of b, b dep masked"
2c7519c0
ZJS
470 create_services test15-a test15-b
471 ln -sf test15-b.service /etc/systemd/system/test15-b1.service
472 ln -sf test15-b.service /etc/systemd/system/test15-b2.service
473 ln -sf ../test15-b1.service /run/systemd/system/test15-a.service.requires/
474 ln -sf ../test15-b2.service /usr/lib/systemd/system/test15-a.service.requires/
475 ln -sf /dev/null /etc/systemd/system/test15-a.service.requires/test15-b.service
476 check_ok test15-a Requires test15-b
477
478 clear_services test15-a test15-b
fbc42f13
FB
479}
480
7a670b1d
TM
481test_invalid_dropins () {
482 echo "Testing invalid dropins..."
483 # Assertion failed on earlier versions, command exits unsuccessfully on later versions
484 systemctl cat nonexistent@.service || true
485 create_services a
486 systemctl daemon-reload
487 # Assertion failed on earlier versions, command exits unsuccessfully on later versions
488 systemctl cat a@.service || true
489 systemctl stop a
490 clear_services a
491 return 0
492}
493
fbc42f13 494test_basic_dropins
3b5ab021 495test_linked_units
f5dd6e50 496test_hierarchical_dropins
fbc42f13
FB
497test_template_dropins
498test_alias_dropins
499test_masked_dropins
7a670b1d 500test_invalid_dropins
fbc42f13
FB
501
502touch /testok