From: Mike Yuan Date: Thu, 16 Mar 2023 08:23:17 +0000 (+0800) Subject: test: add test cases for issue #26839 in TEST-03-JOBS X-Git-Tag: v254-rc1~32^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F26844%2Fhead;p=thirdparty%2Fsystemd.git test: add test cases for issue #26839 in TEST-03-JOBS --- diff --git a/test/testsuite-03.units/propagatestopto-and-pullin.target b/test/testsuite-03.units/propagatestopto-and-pullin.target new file mode 100644 index 00000000000..8e409af7690 --- /dev/null +++ b/test/testsuite-03.units/propagatestopto-and-pullin.target @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Requires=sleep-infinity-simple.service +After=sleep-infinity-simple.service +PropagatesStopTo=sleep-infinity-simple.service diff --git a/test/testsuite-03.units/propagatestopto-only.target b/test/testsuite-03.units/propagatestopto-only.target new file mode 100644 index 00000000000..327b7c19ea2 --- /dev/null +++ b/test/testsuite-03.units/propagatestopto-only.target @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +PropagatesStopTo=sleep-infinity-simple.service diff --git a/test/testsuite-03.units/sleep-infinity-simple.service b/test/testsuite-03.units/sleep-infinity-simple.service new file mode 100644 index 00000000000..211346d7c00 --- /dev/null +++ b/test/testsuite-03.units/sleep-infinity-simple.service @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: LGPL-2.1-or-later +[Unit] +Description=Sleep infinitely + +[Service] +Type=simple +ExecStart=/bin/sleep infinity diff --git a/test/units/testsuite-03.sh b/test/units/testsuite-03.sh index 6ed7d8687a1..22c500debf0 100755 --- a/test/units/testsuite-03.sh +++ b/test/units/testsuite-03.sh @@ -3,6 +3,9 @@ set -eux set -o pipefail +# shellcheck source=test/units/util.sh +. "$(dirname "$0")"/util.sh + # Simple test for that daemon-reexec works in container. # See: https://github.com/systemd/systemd/pull/23883 systemctl daemon-reexec @@ -127,4 +130,19 @@ for i in {0..19}; do systemctl start "transaction-cycle$i.service" done +# Test PropagatesStopTo= when restart (issue #26839) +systemctl start propagatestopto-and-pullin.target +systemctl --quiet is-active propagatestopto-and-pullin.target + +systemctl restart propagatestopto-and-pullin.target +systemctl --quiet is-active propagatestopto-and-pullin.target +systemctl --quiet is-active sleep-infinity-simple.service + +systemctl start propagatestopto-only.target +systemctl --quiet is-active propagatestopto-only.target +systemctl --quiet is-active sleep-infinity-simple.service + +systemctl restart propagatestopto-only.target +assert_rc 3 systemctl --quiet is-active sleep-infinity-simple.service + touch /testok