]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
TEST-82-SOFTREBOOT: test that creds for surviving units are carried over 32800/head
authorMike Yuan <me@yhndnzj.com>
Tue, 14 May 2024 11:34:11 +0000 (19:34 +0800)
committerMike Yuan <me@yhndnzj.com>
Wed, 15 May 2024 16:48:17 +0000 (00:48 +0800)
test/units/TEST-82-SOFTREBOOT.sh

index 7a1d8a9221b0d19b1ffc974933b203771aa763cc..b76ca9af3236e80c8f0c7faebea433e105ff2015 100755 (executable)
@@ -44,6 +44,9 @@ if [ -f /run/TEST-82-SOFTREBOOT.touch3 ]; then
     test "$(systemctl show -P ActiveState TEST-82-SOFTREBOOT-nosurvive-sigterm.service)" != "active"
     test "$(systemctl show -P ActiveState TEST-82-SOFTREBOOT-nosurvive.service)" != "active"
 
+    [[ ! -e /run/credentials/TEST-82-SOFTREBOOT-nosurvive.service ]]
+    assert_eq "$(cat /run/credentials/TEST-82-SOFTREBOOT-survive-argv.service/preserve)" "yay"
+
     # Check journals
     journalctl -o short-monotonic --no-hostname --grep '(will soft-reboot|KILL|corrupt)'
     assert_eq "$(journalctl -q -o short-monotonic -u systemd-journald.service --grep 'corrupt')" ""
@@ -195,7 +198,7 @@ EOF
     # 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 --collect --service-type=notify -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=TEST-82-SOFTREBOOT-nosurvive-sigterm.service "$survive_sigterm"
-    systemd-run --collect --service-type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes --unit=TEST-82-SOFTREBOOT-nosurvive.service sleep infinity
+    systemd-run --collect --service-type=exec -p DefaultDependencies=no -p IgnoreOnIsolate=yes -p SetCredential=gone:hoge --unit=TEST-82-SOFTREBOOT-nosurvive.service sleep infinity
 
     # Ensure that the unit doesn't get deactivated by dependencies on the source file. Given it's a verity
     # image that is already open, even if the tmpfs with the image goes away, the file will be pinned by the
@@ -212,6 +215,7 @@ EOF
         --property After=basic.target \
         --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" \
+        --property SetCredential=preserve:yay \
          "$survive_argv"
     systemd-run --service-type=exec --unit=TEST-82-SOFTREBOOT-survive.service \
         --property TemporaryFileSystem="/run /tmp /var" \