mirror of
https://github.com/Dasharo/systemd.git
synced 2026-03-06 15:02:31 -08:00
Merge pull request #29428 from mrc0mmand/soft-reboot
test: spawn the to-be-killed-on-soft-reboot units with --collect
This commit is contained in:
@@ -75,7 +75,7 @@ elif [ -f /run/testsuite82.touch2 ]; then
|
||||
mount
|
||||
|
||||
# Restart the unit that is not supposed to survive
|
||||
systemd-run -p Type=exec --unit=testsuite-82-nosurvive.service sleep infinity
|
||||
systemd-run --collect --service-type=exec --unit=testsuite-82-nosurvive.service sleep infinity
|
||||
|
||||
# Now issue the soft reboot. We should be right back soon.
|
||||
touch /run/testsuite82.touch3
|
||||
@@ -131,7 +131,7 @@ elif [ -f /run/testsuite82.touch ]; then
|
||||
mount --bind / /run/nextroot/original-root
|
||||
|
||||
# Restart the unit that is not supposed to survive
|
||||
systemd-run -p Type=exec --unit=testsuite-82-nosurvive.service sleep infinity
|
||||
systemd-run --collect --service-type=exec --unit=testsuite-82-nosurvive.service sleep infinity
|
||||
|
||||
# Now issue the soft reboot. We should be right back soon.
|
||||
touch /run/testsuite82.touch2
|
||||
@@ -170,13 +170,13 @@ EOF
|
||||
# This sets DefaultDependencies=no so that they remain running until the very end, and
|
||||
# IgnoreOnIsolate=yes so that they aren't stopped via the "testsuite.target" isolation we do on next boot,
|
||||
# and will be killed by the final sigterm/sigkill spree.
|
||||
systemd-run -p Type=notify -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=testsuite-82-nosurvive-sigterm.service "$survive_sigterm"
|
||||
systemd-run -p Type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=testsuite-82-nosurvive.service sleep infinity
|
||||
systemd-run --collect --service-type=notify -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=testsuite-82-nosurvive-sigterm.service "$survive_sigterm"
|
||||
systemd-run --collect --service-type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=testsuite-82-nosurvive.service sleep infinity
|
||||
|
||||
# Configure these transient units to survive the soft reboot - they will not conflict with shutdown.target
|
||||
# and it will be ignored on the isolate that happens in the next boot. The first will use argv[0][0] =
|
||||
# '@', and the second will use SurviveFinalKillSignal=yes. Both should survive.
|
||||
systemd-run -p Type=notify --unit=testsuite-82-survive-argv.service \
|
||||
systemd-run --service-type=notify --unit=testsuite-82-survive-argv.service \
|
||||
--property SurviveFinalKillSignal=no \
|
||||
--property IgnoreOnIsolate=yes \
|
||||
--property DefaultDependencies=no \
|
||||
@@ -184,7 +184,7 @@ EOF
|
||||
--property "Conflicts=reboot.target kexec.target poweroff.target halt.target emergency.target rescue.target" \
|
||||
--property "Before=reboot.target kexec.target poweroff.target halt.target emergency.target rescue.target" \
|
||||
"$survive_argv"
|
||||
systemd-run -p Type=exec --unit=testsuite-82-survive.service \
|
||||
systemd-run --service-type=exec --unit=testsuite-82-survive.service \
|
||||
--property SurviveFinalKillSignal=yes \
|
||||
--property IgnoreOnIsolate=yes \
|
||||
--property DefaultDependencies=no \
|
||||
@@ -195,9 +195,9 @@ EOF
|
||||
|
||||
# Check that we can set up an inhibitor, and that busctl monitor sees the
|
||||
# PrepareForShutdownWithMetadata signal and that it says 'soft-reboot'.
|
||||
systemd-run --unit busctl.service -p Type=exec --property StandardOutput=file:/run/testsuite82.signal \
|
||||
systemd-run --unit busctl.service --service-type=exec --property StandardOutput=file:/run/testsuite82.signal \
|
||||
busctl monitor --json=pretty --match 'sender=org.freedesktop.login1,path=/org/freedesktop/login1,interface=org.freedesktop.login1.Manager,member=PrepareForShutdownWithMetadata,type=signal'
|
||||
systemd-run --unit inhibit.service -p Type=exec \
|
||||
systemd-run --unit inhibit.service --service-type=exec \
|
||||
systemd-inhibit --what=shutdown --who=test --why=test --mode=delay \
|
||||
sleep infinity
|
||||
|
||||
|
||||
Reference in New Issue
Block a user