]> git.ipfire.org Git - thirdparty/systemd.git/blame - test/units/testsuite-42.sh
Merge pull request #18701 from bugaevc/mdns-unicast
[thirdparty/systemd.git] / test / units / testsuite-42.sh
CommitLineData
ff12a795 1#!/usr/bin/env bash
02baf239
DT
2set -ex
3
4systemd-analyze log-level debug
5
6systemd-run --unit=simple1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple -p ExecStopPost='/bin/touch /run/simple1' true
7test -f /run/simple1
8
4e20fe27
ZJS
9systemd-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
11test -f /run/simple2
12
13systemd-run --unit=exec1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec -p ExecStopPost='/bin/touch /run/exec1' sleep 1
14test -f /run/exec1
15
4e20fe27
ZJS
16systemd-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
18test -f /run/exec2
19
0ee99483 20cat >/tmp/forking1.sh <<EOF
ff12a795 21#!/usr/bin/env bash
02baf239
DT
22
23set -eux
24
25sleep 4 &
26MAINPID=\$!
27disown
28
29systemd-notify MAINPID=\$MAINPID
30EOF
31chmod +x /tmp/forking1.sh
32
33systemd-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
34test -f /run/forking1
35
0ee99483 36cat >/tmp/forking2.sh <<EOF
ff12a795 37#!/usr/bin/env bash
02baf239
DT
38
39set -eux
40
41( sleep 4; exit 1 ) &
42MAINPID=\$!
43disown
44
45systemd-notify MAINPID=\$MAINPID
46EOF
47chmod +x /tmp/forking2.sh
48
4e20fe27
ZJS
49systemd-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
51test -f /run/forking2
52
53systemd-run --unit=oneshot1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=oneshot -p ExecStopPost='/bin/touch /run/oneshot1' true
54test -f /run/oneshot1
55
4e20fe27
ZJS
56systemd-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
58test -f /run/oneshot2
59
60systemd-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 || :
63test -f /run/dbus1
64
61494724 65systemd-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
66test -f /run/dbus2
67
0ee99483 68cat >/tmp/notify1.sh <<EOF
ff12a795 69#!/usr/bin/env bash
02baf239
DT
70
71set -eux
72
73systemd-notify --ready
74EOF
75chmod +x /tmp/notify1.sh
76
77systemd-run --unit=notify1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=notify -p ExecStopPost='/bin/touch /run/notify1' /tmp/notify1.sh
78test -f /run/notify1
79
4e20fe27
ZJS
80systemd-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
82test -f /run/notify2
83
84systemd-run --unit=idle1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=idle -p ExecStopPost='/bin/touch /run/idle1' true
85test -f /run/idle1
86
4e20fe27
ZJS
87systemd-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
89test -f /run/idle2
90
91systemd-analyze log-level info
92
0ee99483 93echo OK >/testok
02baf239
DT
94
95exit 0