3 Provides unit tests and examples for the <Systemd> lens.
11 Description=RPC bind service
12 Description=RPC bind\\
14 Description= Resets System Activity Logs
16 (* Test: Systemd.lns *)
17 test Systemd.lns get desc =
23 { "value" = "RPC bind service" }
26 { "value" = "RPC bind\
30 { "value" = "Resets System Activity Logs" }
36 After=syslog.target network.target
37 Also=canberra-system-shutdown.service canberra-system-shutdown-reboot.service
38 Before=sysinit.target shutdown.target
39 CapabilityBoundingSet=CAP_SYS_ADMIN CAP_SETUID CAP_SETGID
40 Conflicts=emergency.service emergency.target
41 ControlGroup=%R/user/%I/shared cpu:/
42 ListenNetlink=kobject-uevent 1
43 Requires=shutdown.target umount.target final.target
44 Sockets=udev-control.socket udev-kernel.socket
45 WantedBy=halt.target poweroff.target
46 Wants=local-fs.target swap.target
47 Wants=local-fs.target \
49 Wants=local-fs.target\
51 Wants= local-fs.target
53 (* Test: Systemd.lns *)
54 test Systemd.lns get multi =
57 { "value" = "syslog.target" }
58 { "value" = "network.target" }
61 { "value" = "canberra-system-shutdown.service" }
62 { "value" = "canberra-system-shutdown-reboot.service" }
65 { "value" = "sysinit.target" }
66 { "value" = "shutdown.target" }
68 { "CapabilityBoundingSet"
69 { "value" = "CAP_SYS_ADMIN" }
70 { "value" = "CAP_SETUID" }
71 { "value" = "CAP_SETGID" }
74 { "value" = "emergency.service" }
75 { "value" = "emergency.target" }
78 { "value" = "%R/user/%I/shared" }
82 { "value" = "kobject-uevent" }
86 { "value" = "shutdown.target" }
87 { "value" = "umount.target" }
88 { "value" = "final.target" }
91 { "value" = "udev-control.socket" }
92 { "value" = "udev-kernel.socket" }
95 { "value" = "halt.target" }
96 { "value" = "poweroff.target" }
99 { "value" = "local-fs.target" }
100 { "value" = "swap.target" }
103 { "value" = "local-fs.target" }
104 { "value" = "swap.target" }
107 { "value" = "local-fs.target" }
108 { "value" = "swap.target" }
111 { "value" = "local-fs.target" }
116 let exec = "[Service]
118 ExecReload=/bin/kill -USR1 $MAINPID
119 ExecStart=/sbin/rpcbind -w
120 ExecStartPost=/bin/systemctl disable firstboot-graphical.service firstboot-text.service
121 ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS
122 ExecStop=/usr/sbin/aiccu stop
123 ExecStopPost=-/bin/systemctl poweroff
124 ExecStopPost=@/bin/systemctl poweroff
125 ExecStopPost=-@/bin/systemctl poweroff
126 ExecStopPost=/bin/systemctl\
129 (* Test: Systemd.lns *)
130 test Systemd.lns get exec =
133 { "command" = "/bin/ls" }
136 { "command" = "/bin/kill" }
143 { "command" = "/sbin/rpcbind" }
149 { "command" = "/bin/systemctl" }
152 { "2" = "firstboot-graphical.service" }
153 { "3" = "firstboot-text.service" }
157 { "command" = "/sbin/modprobe" }
160 { "2" = "$SUPPORTED_DRIVERS" }
164 { "command" = "/usr/sbin/aiccu" }
171 { "command" = "/bin/systemctl" }
178 { "command" = "/bin/systemctl" }
186 { "command" = "/bin/systemctl" }
192 { "command" = "/bin/systemctl" }
202 Environment=LANG=C FOO=BAR
203 Environment=LANG= LANGUAGE= LC_CTYPE= LC_NUMERIC= LC_TIME= LC_COLLATE= LC_MONETARY= LC_MESSAGES= LC_PAPER= LC_NAME= LC_ADDRESS= LC_TELEPHONE= LC_MEASUREMENT= LC_IDENTIFICATION=
206 Environment=\"LANG=foo bar\" FOO=BAR
207 Environment=OPTIONS=\"-LS0-6d\"
208 Environment=OPTIONS='-LS0-6d'
209 Environment=VAR=\"with some spaces\" VAR2='more spaces'
210 Environment=VAR='with some spaces'
212 (* Test: Systemd.lns *)
213 test Systemd.lns get env =
236 { "LC_IDENTIFICATION" }
243 { "LANG" = "foo bar" }
247 { "OPTIONS" = "\"-LS0-6d\"" }
250 { "OPTIONS" = "'-LS0-6d'" }
253 { "VAR" = "\"with some spaces\"" }
254 { "VAR2" = "'more spaces'" }
257 { "VAR" = "'with some spaces'" }
262 let unit = "# This file is part of systemd.
265 # See systemd.special(7) for details
267 .include /etc/example
270 Description=Locale Service
272 .include /etc/example
275 ExecStart=/lib/systemd/systemd-localed
277 BusName=org.freedesktop.locale1
278 CapabilityBoundingSet=
281 (* Test: Systemd.lns *)
282 test Systemd.lns get unit =
283 { "#comment" = "This file is part of systemd." }
286 { "#comment" = "See systemd.special(7) for details" }
288 { ".include" = "/etc/example" }
292 { "value" = "Locale Service" }
294 { "#comment" = "Add another file" }
295 { ".include" = "/etc/example" }
300 { "command" = "/lib/systemd/systemd-localed" }
306 { "value" = "org.freedesktop.locale1" }
308 { "CapabilityBoundingSet" }
313 Values can contain backslashes *)
314 test Systemd.entry_command get "ExecStart=/usr/bin/find /var/lib/sudo -exec /usr/bin/touch -t 198501010000 '{}' \073\n" =
316 { "command" = "/usr/bin/find" }
318 { "1" = "/var/lib/sudo" }
320 { "3" = "/usr/bin/touch" }
322 { "5" = "198501010000" }
328 let exec_tmux = "ExecStart=/usr/bin/tmux unbind-key -a; \
329 kill-window -t anaconda:shell; \
330 bind-key ? list-keys\n"
333 Semicolons are permitted in entry values, e.g. as part of a command *)
334 test Systemd.entry_command get exec_tmux =
336 { "command" = "/usr/bin/tmux" }
338 { "1" = "unbind-key" }
340 { "3" = "kill-window" }
342 { "5" = "anaconda:shell;" }
345 { "8" = "list-keys" } } }
348 # and ; are OK for standalone comments, but # only for EOL comments *)
349 test Systemd.lns get "[Service]\n# hash\n; semicolon\nExecStart=/bin/echo # hash\n" =
351 { "#comment" = "hash" }
352 { "#comment" = "semicolon" }
354 { "command" = "/bin/echo" }
355 { "#comment" = "hash" } } }
358 empty quoted environment var values *)
359 test Systemd.lns get "[Service]\nEnvironment=TERM=linux PX_MODULE_PATH=\"\"\n" =
363 { "PX_MODULE_PATH" = "\"\"" } } }
366 values may start with spaces *)
367 test Systemd.lns get "[Service]\nExecStart= /usr/bin/find\nEnvironment= TERM=linux\n" =
370 { "command" = "/usr/bin/find" } }
372 { "TERM" = "linux" } } }