From: Luca Boccassi Date: Sat, 14 Dec 2024 16:44:40 +0000 (+0000) Subject: test: include MAINPID in notify message in TEST-50-DISSECT for notify socket X-Git-Tag: v258-rc1~1854 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=498c20fad6a472dfbbfacc1ed55754f9ebfa869e;p=thirdparty%2Fsystemd.git test: include MAINPID in notify message in TEST-50-DISSECT for notify socket Copy what systemd-notify does by default by setting it to the PID of the shell, so that main process tracking works as expected. Also use test -S instead of ls to check socket. [ 33.980396] (sh)[1024]: run-p1022-i1322.service: Executing: sh -c "echo READY=1 | ncat --unixsock --udp \$NOTIFY_SOCKET --source /run/notify && env" [ 34.138778] systemd[1]: run-p1022-i1322.service: Child 1024 belongs to run-p1022-i1322.service. [ 34.138825] systemd[1]: run-p1022-i1322.service: Main process exited, code=exited, status=0/SUCCESS (success) [ 34.139451] systemd[1]: run-p1022-i1322.service: Failed with result 'protocol'. [ 34.139559] systemd[1]: run-p1022-i1322.service: Service will not restart (restart setting) [ 34.139573] systemd[1]: run-p1022-i1322.service: Changed start -> failed [ 34.139945] systemd[1]: run-p1022-i1322.service: Job 1364 run-p1022-i1322.service/start finished, result=failed Fixes #35619 Follow-up for 18bb30c3b2ea7f4497edf86414133667b3e155fe --- diff --git a/test/units/TEST-50-DISSECT.dissect.sh b/test/units/TEST-50-DISSECT.dissect.sh index 180d069cf16..a66b617c086 100755 --- a/test/units/TEST-50-DISSECT.dissect.sh +++ b/test/units/TEST-50-DISSECT.dissect.sh @@ -81,8 +81,8 @@ 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 'echo READY=1 | ncat --unixsock --udp $NOTIFY_SOCKET --source /run/notify && ls /run/host/notify' -systemd-run --wait -p RootImage="$MINIMAL_IMAGE.raw" -p NotifyAccess=all --service-type=notify --pipe sh -c 'echo READY=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 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 -P -p RootImage="$MINIMAL_IMAGE.raw" cat /usr/lib/os-release | grep -q -F "MARKER=1" mv "$MINIMAL_IMAGE.verity" "$MINIMAL_IMAGE.fooverity"