From: Yu Watanabe Date: Sun, 15 Dec 2024 02:02:11 +0000 (+0900) Subject: TEST-50-DISSECT: add test case with systemd-notify X-Git-Tag: v258-rc1~1848 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0a63cf0412ccb9b4edd1f6048e25aa7f68b0133;p=thirdparty%2Fsystemd.git TEST-50-DISSECT: add test case with systemd-notify This also merges the previous test cases into one. Follow-up for 284dd31e9d7d25e8a0bdfee60cf938ab961f2a7a and 498c20fad6a472dfbbfacc1ed55754f9ebfa869e. --- diff --git a/test/units/TEST-50-DISSECT.dissect.sh b/test/units/TEST-50-DISSECT.dissect.sh index a66b617c086..2ca07453ec0 100755 --- a/test/units/TEST-50-DISSECT.dissect.sh +++ b/test/units/TEST-50-DISSECT.dissect.sh @@ -81,8 +81,40 @@ systemd-run --wait -p RootImage="$MINIMAL_IMAGE.raw" mountpoint /run/systemd/jou # Test that the notify socket is bind mounted to /run/host/notify in sandboxed environments and # $NOTIFY_SOCKET is set correctly. -systemd-run --wait -p RootImage="$MINIMAL_IMAGE.raw" -p NotifyAccess=all --service-type=notify --pipe sh -c 'printf MAINPID=$$$$\\nREADY=1 | ncat --unixsock --udp $NOTIFY_SOCKET --source /run/notify && test -S /run/host/notify' -systemd-run --wait -p RootImage="$MINIMAL_IMAGE.raw" -p NotifyAccess=all --service-type=notify --pipe sh -c 'printf MAINPID=$$$$\\nREADY=1 | ncat --unixsock --udp $NOTIFY_SOCKET --source /run/notify && env' | grep NOTIFY_SOCKET=/run/host/notify +systemd-run \ + --wait \ + -p RootImage="$MINIMAL_IMAGE.raw" \ + -p NotifyAccess=all \ + --service-type=notify \ + --pipe \ + bash -xec \ + ' + printf MAINPID=$$$$\\nREADY=1 | ncat --unixsock --udp $NOTIFY_SOCKET --source /run/notify + [[ "$$NOTIFY_SOCKET" == "/run/host/notify" ]] + [[ "$$(env)" =~ "NOTIFY_SOCKET=/run/host/notify" ]] + test -S /run/host/notify + ' +if [[ "$(findmnt -n -o FSTYPE /)" == btrfs ]]; then + [[ -d /test-dissect-btrfs-snapshot ]] && btrfs subvolume delete /test-dissect-btrfs-snapshot + btrfs subvolume snapshot / /test-dissect-btrfs-snapshot + + # Same test with systemd-notify and RootDirectory= + systemd-run \ + --wait \ + -p RootDirectory=/test-dissect-btrfs-snapshot \ + -p NotifyAccess=all \ + --service-type=notify \ + --pipe \ + bash -xec \ + ' + systemd-notify --pid=auto --ready + [[ "$$NOTIFY_SOCKET" == "/run/host/notify" ]] + [[ "$(env)" =~ "NOTIFY_SOCKET=/run/host/notify" ]] + test -S /run/host/notify + ' + + btrfs subvolume delete /test-dissect-btrfs-snapshot +fi systemd-run -P -p RootImage="$MINIMAL_IMAGE.raw" cat /usr/lib/os-release | grep -q -F "MARKER=1" mv "$MINIMAL_IMAGE.verity" "$MINIMAL_IMAGE.fooverity"