richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
ff6046
From bf7631e7c0a7d1cac2f071ce998d5c669aa5abd7 Mon Sep 17 00:00:00 2001
ff6046
From: Frantisek Sumsal <frantisek@sumsal.cz>
ff6046
Date: Tue, 29 Jan 2019 19:33:15 +0100
ff6046
Subject: [PATCH] test: replace echo with socat
ff6046
ff6046
The original version of the test used netcat along with a standard
ff6046
AF_UNIX socket, which caused issues across different netcat
ff6046
implementations. The AF_UNIX socket was then replaced by a FIFO with a
ff6046
simple echo, which, however, suffers from the same issue (some echo
ff6046
implementations don't check if the write() was successful).
ff6046
ff6046
Let's revert back to the AF_UNIX socket, but replace netcat with socat,
ff6046
which, hopefully, resolves the main issue.
ff6046
ff6046
Relevant commit: 9b45c2bf02a43e3e1b42de1ab0c3fe29c64dc5f5
ff6046
ff6046
(cherry picked from commit b35d6d828b3216d022e565820d9971cb0f7746c1)
ff6046
---
ff6046
 test/TEST-10-ISSUE-2467/test.sh | 6 +++---
ff6046
 1 file changed, 3 insertions(+), 3 deletions(-)
ff6046
ff6046
diff --git a/test/TEST-10-ISSUE-2467/test.sh b/test/TEST-10-ISSUE-2467/test.sh
ff6046
index e61f5acd3c..0e61236686 100755
ff6046
--- a/test/TEST-10-ISSUE-2467/test.sh
ff6046
+++ b/test/TEST-10-ISSUE-2467/test.sh
ff6046
@@ -17,7 +17,7 @@ test_setup() {
ff6046
         eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
ff6046
 
ff6046
         setup_basic_environment
ff6046
-        dracut_install true rm
ff6046
+        dracut_install true rm socat
ff6046
 
ff6046
         # setup the testsuite service
ff6046
         cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
ff6046
@@ -29,13 +29,13 @@ After=multi-user.target
ff6046
 Type=oneshot
ff6046
 StandardOutput=tty
ff6046
 StandardError=tty
ff6046
-ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; echo > /run/test.ctl; >/testok'
ff6046
+ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; printf x > test.file; socat -t20 OPEN:test.file UNIX-CONNECT:/run/test.ctl; >/testok'
ff6046
 TimeoutStartSec=10s
ff6046
 EOF
ff6046
 
ff6046
 	cat  >$initdir/etc/systemd/system/test.socket <<'EOF'
ff6046
 [Socket]
ff6046
-ListenFIFO=/run/test.ctl
ff6046
+ListenStream=/run/test.ctl
ff6046
 EOF
ff6046
 
ff6046
 	cat > $initdir/etc/systemd/system/test.service <<'EOF'