From d37b9154a78ccc31089345a7ed6256ed6e0e67b8 Mon Sep 17 00:00:00 2001 From: Frantisek Sumsal Date: Sat, 23 Sep 2023 18:52:03 +0200 Subject: [PATCH] test: check soft-reboot behavior wrt argv[0][0] == '@' --- test/units/testsuite-82.sh | 50 +++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/test/units/testsuite-82.sh b/test/units/testsuite-82.sh index 24bd976b87..b6b6615997 100755 --- a/test/units/testsuite-82.sh +++ b/test/units/testsuite-82.sh @@ -20,8 +20,10 @@ if [ -f /run/testsuite82.touch3 ]; then read -r x <&5 test "$x" = "oinkoink" - # Check that the surviving service is still around + # Check that the surviving services are still around test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active" + test "$(systemctl show -P ActiveState testsuite-82-survive-argv.service)" = "active" + test "$(systemctl show -P ActiveState testsuite-82-nosurvive-sigterm.service)" != "active" test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active" # All succeeded, exit cleanly now @@ -43,8 +45,10 @@ elif [ -f /run/testsuite82.touch2 ]; then systemd-notify --fd=3 --pid=parent 3<"$T" rm "$T" - # Check that the surviving service is still around + # Check that the surviving services are still around test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active" + test "$(systemctl show -P ActiveState testsuite-82-survive-argv.service)" = "active" + test "$(systemctl show -P ActiveState testsuite-82-nosurvive-sigterm.service)" != "active" test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active" # Test that we really are in the new overlayfs root fs @@ -88,8 +92,10 @@ elif [ -f /run/testsuite82.touch ]; then systemd-notify --fd=3 --pid=parent 3<"$T" rm "$T" - # Check that the surviving service is still around + # Check that the surviving services are still around test "$(systemctl show -P ActiveState testsuite-82-survive.service)" = "active" + test "$(systemctl show -P ActiveState testsuite-82-survive-argv.service)" = "active" + test "$(systemctl show -P ActiveState testsuite-82-nosurvive-sigterm.service)" != "active" test "$(systemctl show -P ActiveState testsuite-82-nosurvive.service)" != "active" # This time we test the /run/nextroot/ root switching logic. (We synthesize a new rootfs from the old via overlayfs) @@ -129,8 +135,41 @@ else systemd-notify --fd=3 --pid=parent 3<"$T" rm "$T" - # Configure this transient unit to survive the soft reboot - it will not conflict with shutdown.target - # and it will be ignored on the isolate that happens in the next boot. + survive_sigterm="/dev/shm/survive-sigterm-$RANDOM.sh" + cat >"$survive_sigterm" <"$survive_argv" <