diff options
Diffstat (limited to '')
25 files changed, 219 insertions, 0 deletions
diff --git a/test/testsuite-23.units/testsuite-23-binds-to.service b/test/testsuite-23.units/testsuite-23-binds-to.service new file mode 100644 index 0000000..637fea4 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-binds-to.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Unit with BindsTo= +BindsTo=testsuite-23-bound-by.service +After=testsuite-23-bound-by.service + +[Service] +ExecStart=/bin/sleep infinity +# --kill-who= (no 'm') to check that the short form is accepted +ExecStopPost=systemctl kill --kill-whom=main -sRTMIN+1 testsuite-23.service diff --git a/test/testsuite-23.units/testsuite-23-bound-by.service b/test/testsuite-23.units/testsuite-23-bound-by.service new file mode 100644 index 0000000..a2df5a1 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-bound-by.service @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Unit with BoundBy= + +[Service] +ExecStart=/bin/sleep 0.7 diff --git a/test/testsuite-23.units/testsuite-23-fail.service b/test/testsuite-23.units/testsuite-23-fail.service new file mode 100644 index 0000000..36f8baa --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-fail.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Failing unit +OnFailure=testsuite-23-uphold.service + +[Service] +ExecStart=/bin/false diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-1.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-1.service new file mode 100644 index 0000000..9919a9f --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-1.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Service] +Type=notify +NotifyAccess=all +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=/bin/bash -c 'touch /tmp/shared-private-file && systemd-notify --ready && sleep infinity' diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-2.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-2.service new file mode 100644 index 0000000..36b4c27 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-2.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +JoinsNamespaceOf=testsuite-23-joins-namespace-of-1.service + +[Service] +Type=oneshot +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=test -e /tmp/shared-private-file +ExecStart=touch /tmp/hoge diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-3.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-3.service new file mode 100644 index 0000000..9094445 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-3.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +JoinsNamespaceOf=testsuite-23-joins-namespace-of-1.service + +[Service] +Type=oneshot +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=test -e /tmp/shared-private-file +ExecStart=test -e /tmp/hoge diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-4.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-4.service new file mode 100644 index 0000000..5e823a1 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-4.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +JoinsNamespaceOf=testsuite-23-joins-namespace-of-5.service + +[Service] +Type=notify +NotifyAccess=all +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=/bin/bash -c 'touch /tmp/shared-private-file && systemd-notify --ready && sleep infinity' diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-5.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-5.service new file mode 100644 index 0000000..c3d316b --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-5.service @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Service] +Type=oneshot +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=test -e /tmp/shared-private-file diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-6.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-6.service new file mode 100644 index 0000000..bbbfd7c --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-6.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +JoinsNamespaceOf=testsuite-23-joins-namespace-of-8.service + +[Service] +Type=notify +NotifyAccess=all +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=/bin/bash -c 'touch /tmp/shared-private-file-x && systemd-notify --ready && sleep infinity' diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-7.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-7.service new file mode 100644 index 0000000..60c083a --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-7.service @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +JoinsNamespaceOf=testsuite-23-joins-namespace-of-8.service + +[Service] +Type=oneshot +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=test -e /tmp/shared-private-file-x +ExecStart=test ! -e /tmp/shared-private-file-y +ExecStart=touch /tmp/hoge diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-8.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-8.service new file mode 100644 index 0000000..dac1cea --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-8.service @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Service] +Type=notify +NotifyAccess=all +MountAPIVFS=yes +PrivateTmp=yes +ExecStartPre=test -e /tmp/shared-private-file-x +ExecStartPre=test -e /tmp/hoge +ExecStart=/bin/bash -c 'touch /tmp/shared-private-file-y && systemd-notify --ready && sleep infinity' diff --git a/test/testsuite-23.units/testsuite-23-joins-namespace-of-9.service b/test/testsuite-23.units/testsuite-23-joins-namespace-of-9.service new file mode 100644 index 0000000..6c64873 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-joins-namespace-of-9.service @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +JoinsNamespaceOf=testsuite-23-joins-namespace-of-8.service + +[Service] +Type=oneshot +MountAPIVFS=yes +PrivateTmp=yes +ExecStart=test -e /tmp/shared-private-file-x +ExecStart=test -e /tmp/shared-private-file-y +ExecStart=test -e /tmp/hoge diff --git a/test/testsuite-23.units/testsuite-23-namespaced.service b/test/testsuite-23.units/testsuite-23-namespaced.service new file mode 100644 index 0000000..5a6f5cd --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-namespaced.service @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Service] +RuntimeMaxSec=300 +# Adding a new mounts at runtime works if the unit is in the active state, +# so use Type=notify to make sure there's no race condition in the test +Type=notify +RemainAfterExit=yes +MountAPIVFS=yes +PrivateTmp=yes +BindPaths=/run/testsuite-23-marker-fixed:/tmp/testfile-marker-fixed +InaccessiblePaths=/run/inaccessible +ExecStartPre=grep -q -F MARKER_FIXED /tmp/testfile-marker-fixed +ExecStart=/bin/sh -c 'systemd-notify --ready; until grep -q -F MARKER_RUNTIME /tmp/testfile-marker-runtime; do sleep 0.1; done; test ! -f /run/inaccessible/testfile-marker-fixed' diff --git a/test/testsuite-23.units/testsuite-23-non-namespaced.service b/test/testsuite-23.units/testsuite-23-non-namespaced.service new file mode 100644 index 0000000..6f93c3b --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-non-namespaced.service @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Service] +RuntimeMaxSec=5 +Type=notify +RemainAfterExit=yes +ExecStart=/bin/sh -c 'systemd-notify --ready; until grep -q -F MARKER_RUNTIME /tmp/testfile-marker-runtime; do sleep 0.1; done; exit 0' diff --git a/test/testsuite-23.units/testsuite-23-prop-stop-one.service b/test/testsuite-23.units/testsuite-23-prop-stop-one.service new file mode 100644 index 0000000..f068daf --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-prop-stop-one.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Stop Propagation Receiver +Wants=testsuite-23-prop-stop-two.service +After=testsuite-23-prop-stop-two.service +StopPropagatedFrom=testsuite-23-prop-stop-two.service + +[Service] +ExecStart=/bin/sleep infinity +ExecStopPost=systemctl kill --kill-whom=main -sUSR2 testsuite-23.service diff --git a/test/testsuite-23.units/testsuite-23-prop-stop-two.service b/test/testsuite-23.units/testsuite-23-prop-stop-two.service new file mode 100644 index 0000000..2bcd209 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-prop-stop-two.service @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Stop Propagation Sender + +[Service] +ExecStart=/bin/sleep 1.5 diff --git a/test/testsuite-23.units/testsuite-23-retry-fail.service b/test/testsuite-23.units/testsuite-23-retry-fail.service new file mode 100644 index 0000000..0fc27c4 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-retry-fail.service @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Failed Dependency Unit + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/sh -c "if [ -f /tmp/testsuite-23-retry-fail ]; then exit 0; else exit 1; fi" +Restart=no diff --git a/test/testsuite-23.units/testsuite-23-retry-upheld.service b/test/testsuite-23.units/testsuite-23-retry-upheld.service new file mode 100644 index 0000000..0426d76 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-retry-upheld.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Upheld Unit +Requires=testsuite-23-retry-fail.service +After=testsuite-23-retry-fail.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/bin/echo ok diff --git a/test/testsuite-23.units/testsuite-23-retry-uphold.service b/test/testsuite-23.units/testsuite-23-retry-uphold.service new file mode 100644 index 0000000..f35e842 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-retry-uphold.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Upholding Unit +Upholds=testsuite-23-retry-upheld.service + +[Service] +ExecStart=/bin/sleep infinity diff --git a/test/testsuite-23.units/testsuite-23-short-lived.service b/test/testsuite-23.units/testsuite-23-short-lived.service new file mode 100644 index 0000000..2dcb2ae --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-short-lived.service @@ -0,0 +1,11 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Shortlived Unit +StopWhenUnneeded=yes + +# Bump up the start limit logic, so that we can be restarted frequently enough +StartLimitBurst=15 +StartLimitIntervalSec=1h + +[Service] +ExecStart=/usr/lib/systemd/tests/testdata/units/testsuite-23-short-lived.sh diff --git a/test/testsuite-23.units/testsuite-23-specifier-j-depends-wants.service b/test/testsuite-23.units/testsuite-23-specifier-j-depends-wants.service new file mode 100644 index 0000000..c45edd9 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-specifier-j-depends-wants.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Dependent service for percent-j specifier + +[Service] +Type=oneshot +ExecStart=touch /tmp/test-specifier-j-wants diff --git a/test/testsuite-23.units/testsuite-23-specifier-j-wants.service b/test/testsuite-23.units/testsuite-23-specifier-j-wants.service new file mode 100644 index 0000000..9abb257 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-specifier-j-wants.service @@ -0,0 +1,10 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Wants with percent-j specifier +Wants=testsuite-23-specifier-j-depends-%j.service +After=testsuite-23-specifier-j-depends-%j.service + +[Service] +Type=oneshot +ExecStart=test -f /tmp/test-specifier-j-%j +ExecStart=touch /tmp/tetsuite-23-specifier-j-done diff --git a/test/testsuite-23.units/testsuite-23-success.service b/test/testsuite-23.units/testsuite-23-success.service new file mode 100644 index 0000000..410d4f8 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-success.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Succeeding unit +OnSuccess=testsuite-23-fail.service + +[Service] +ExecStart=/bin/true diff --git a/test/testsuite-23.units/testsuite-23-upheldby-install.service b/test/testsuite-23.units/testsuite-23-upheldby-install.service new file mode 100644 index 0000000..a456207 --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-upheldby-install.service @@ -0,0 +1,9 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Unit that sets UpheldBy= through [Install] + +[Service] +ExecStart=/bin/sleep infinity + +[Install] +UpheldBy=testsuite-23-retry-uphold.service diff --git a/test/testsuite-23.units/testsuite-23-uphold.service b/test/testsuite-23.units/testsuite-23-uphold.service new file mode 100644 index 0000000..3549d6a --- /dev/null +++ b/test/testsuite-23.units/testsuite-23-uphold.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Upholding Unit +Upholds=testsuite-23-short-lived.service + +[Service] +ExecStart=/bin/sleep infinity |