]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: send trailing newlines in notify messages in TEST-50-DISSECT
authorLuca Boccassi <luca.boccassi@gmail.com>
Wed, 30 Jul 2025 17:53:09 +0000 (18:53 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 30 Jul 2025 20:43:56 +0000 (05:43 +0900)
It seems the failing test in https://github.com/systemd/systemd/issues/37626
is due to MONOTONIC_USEC= being somehow lost. Add a trailing newline when
sending messages with socat, hopefully ensuring it is delivered and read.

test/units/TEST-50-DISSECT.dissect.sh

index f63f4fcd2af19e9ef073de9b9053932d11e4e400..ff8a5dd4c74e673baccdfb11e18a1606777e36f4 100755 (executable)
@@ -653,12 +653,12 @@ NotifyAccess=all
 ExecStart=bash -x -c ' \
     trap '"'"' \
         now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
-        printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+        printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
         (ls /etc | grep marker) >/tmp/markers/50i; \
         (cat /usr/lib/os-release) >>/tmp/markers/50i; \
-        echo -n "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+        echo "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
     '"'"' SIGHUP; \
-    echo -n "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+    echo "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
     while true; do sleep 1; done; \
 '
 EOF
@@ -688,12 +688,12 @@ NotifyAccess=all
 ExecStart=bash -x -c ' \
     trap '"'"' \
         now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
-        printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+        printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
         (ls /etc | grep marker) >/tmp/markers/50j; \
         (cat /usr/lib/os-release) >>/tmp/markers/50j; \
-        echo -n "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+        echo "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
     '"'"' SIGHUP; \
-    echo -n "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+    echo "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
     while true; do sleep 1; done; \
 '
 EOF
@@ -718,12 +718,12 @@ NotifyAccess=all
 ExecStart=bash -x -c ' \
     trap '"'"' \
         now=\$\$(grep "^now" /proc/timer_list | cut -d" " -f3 | rev | cut -c 4- | rev); \
-        printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+        printf "RELOADING=1\\nMONOTONIC_USEC=\$\${now}\\n" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
         (ls /etc | grep marker) >/tmp/markers/50k; \
         (cat /usr/lib/os-release) >>/tmp/markers/50k; \
-        echo -n "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+        echo "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
     '"'"' SIGHUP; \
-    echo -n "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
+    echo "READY=1" | socat -t 5 - UNIX-SENDTO:\$\$NOTIFY_SOCKET; \
     while true; do sleep 1; done; \
 '
 EOF