]>
Commit | Line | Data |
---|---|---|
ff12a795 | 1 | #!/usr/bin/env bash |
02baf239 DT |
2 | set -ex |
3 | ||
4 | systemd-analyze log-level debug | |
5 | ||
6 | systemd-run --unit=simple1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple -p ExecStopPost='/bin/touch /run/simple1' true | |
7 | test -f /run/simple1 | |
8 | ||
4e20fe27 ZJS |
9 | systemd-run --unit=simple2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple -p ExecStopPost='/bin/touch /run/simple2' false \ |
10 | && { echo 'unexpected success'; exit 1; } | |
02baf239 DT |
11 | test -f /run/simple2 |
12 | ||
13 | systemd-run --unit=exec1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec -p ExecStopPost='/bin/touch /run/exec1' sleep 1 | |
14 | test -f /run/exec1 | |
15 | ||
4e20fe27 ZJS |
16 | systemd-run --unit=exec2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec -p ExecStopPost='/bin/touch /run/exec2' sh -c 'sleep 1; false' \ |
17 | && { echo 'unexpected success'; exit 1; } | |
02baf239 DT |
18 | test -f /run/exec2 |
19 | ||
0ee99483 | 20 | cat >/tmp/forking1.sh <<EOF |
ff12a795 | 21 | #!/usr/bin/env bash |
02baf239 DT |
22 | |
23 | set -eux | |
24 | ||
25 | sleep 4 & | |
26 | MAINPID=\$! | |
27 | disown | |
28 | ||
29 | systemd-notify MAINPID=\$MAINPID | |
30 | EOF | |
31 | chmod +x /tmp/forking1.sh | |
32 | ||
33 | systemd-run --unit=forking1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec -p ExecStopPost='/bin/touch /run/forking1' /tmp/forking1.sh | |
34 | test -f /run/forking1 | |
35 | ||
0ee99483 | 36 | cat >/tmp/forking2.sh <<EOF |
ff12a795 | 37 | #!/usr/bin/env bash |
02baf239 DT |
38 | |
39 | set -eux | |
40 | ||
41 | ( sleep 4; exit 1 ) & | |
42 | MAINPID=\$! | |
43 | disown | |
44 | ||
45 | systemd-notify MAINPID=\$MAINPID | |
46 | EOF | |
47 | chmod +x /tmp/forking2.sh | |
48 | ||
4e20fe27 ZJS |
49 | systemd-run --unit=forking2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=forking -p NotifyAccess=exec -p ExecStopPost='/bin/touch /run/forking2' /tmp/forking2.sh \ |
50 | && { echo 'unexpected success'; exit 1; } | |
02baf239 DT |
51 | test -f /run/forking2 |
52 | ||
53 | systemd-run --unit=oneshot1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot -p ExecStopPost='/bin/touch /run/oneshot1' true | |
54 | test -f /run/oneshot1 | |
55 | ||
4e20fe27 ZJS |
56 | systemd-run --unit=oneshot2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot -p ExecStopPost='/bin/touch /run/oneshot2' false \ |
57 | && { echo 'unexpected success'; exit 1; } | |
02baf239 DT |
58 | test -f /run/oneshot2 |
59 | ||
60 | systemd-run --unit=dbus1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus1' \ | |
61 | busctl call org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus RequestName su systemd.test.ExecStopPost 4 \ | |
62 | || : | |
63 | test -f /run/dbus1 | |
64 | ||
61494724 | 65 | systemd-run --unit=dbus2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=dbus -p BusName=systemd.test.ExecStopPost -p ExecStopPost='/bin/touch /run/dbus2' true |
02baf239 DT |
66 | test -f /run/dbus2 |
67 | ||
0ee99483 | 68 | cat >/tmp/notify1.sh <<EOF |
ff12a795 | 69 | #!/usr/bin/env bash |
02baf239 DT |
70 | |
71 | set -eux | |
72 | ||
73 | systemd-notify --ready | |
74 | EOF | |
75 | chmod +x /tmp/notify1.sh | |
76 | ||
77 | systemd-run --unit=notify1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify -p ExecStopPost='/bin/touch /run/notify1' /tmp/notify1.sh | |
78 | test -f /run/notify1 | |
79 | ||
4e20fe27 ZJS |
80 | systemd-run --unit=notify2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify -p ExecStopPost='/bin/touch /run/notify2' true \ |
81 | && { echo 'unexpected success'; exit 1; } | |
02baf239 DT |
82 | test -f /run/notify2 |
83 | ||
84 | systemd-run --unit=idle1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle1' true | |
85 | test -f /run/idle1 | |
86 | ||
4e20fe27 ZJS |
87 | systemd-run --unit=idle2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle2' false \ |
88 | && { echo 'unexpected success'; exit 1; } | |
02baf239 DT |
89 | test -f /run/idle2 |
90 | ||
91 | systemd-analyze log-level info | |
92 | ||
0ee99483 | 93 | echo OK >/testok |
02baf239 DT |
94 | |
95 | exit 0 |