From fc53809803cd2bc2434e312b19a18fa36776da12 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:40 +0200 Subject: Adding upstream version 256. Signed-off-by: Daniel Baumann --- test/units/TEST-23-UNIT-FILE.ExecStopPost.sh | 104 +++++++++++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100755 test/units/TEST-23-UNIT-FILE.ExecStopPost.sh (limited to 'test/units/TEST-23-UNIT-FILE.ExecStopPost.sh') diff --git a/test/units/TEST-23-UNIT-FILE.ExecStopPost.sh b/test/units/TEST-23-UNIT-FILE.ExecStopPost.sh new file mode 100755 index 0000000..aeaf3aa --- /dev/null +++ b/test/units/TEST-23-UNIT-FILE.ExecStopPost.sh @@ -0,0 +1,104 @@ +#!/usr/bin/env bash +# SPDX-License-Identifier: LGPL-2.1-or-later +set -eux + +# Test that ExecStopPost= is always run + +systemd-analyze log-level debug + +systemd-run --unit=simple1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple \ + -p ExecStopPost='/bin/touch /run/simple1' true +test -f /run/simple1 + +(! systemd-run --unit=simple2.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=simple \ + -p ExecStopPost='/bin/touch /run/simple2' false) +test -f /run/simple2 + +systemd-run --unit=exec1.service --wait -p StandardOutput=tty -p StandardError=tty -p Type=exec \ + -p ExecStopPost='/bin/touch /run/exec1' sleep 1 +test -f /run/exec1 + +(! 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') +test -f /run/exec2 + +cat >/tmp/forking1.sh </tmp/forking2.sh </tmp/notify1.sh <