TEST-50-DISSECT: add test case with systemd-notify
This also merges the previous test cases into one. Follow-up for284dd31e9dand498c20fad6.
This commit is contained in:
committed by
Luca Boccassi
parent
106f64cbd6
commit
d0a63cf041
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user