]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
test: replace echo with socat
authorFrantisek Sumsal <frantisek@sumsal.cz>
Tue, 29 Jan 2019 18:33:15 +0000 (19:33 +0100)
committerEvgeny Vereshchagin <evvers@ya.ru>
Tue, 12 Feb 2019 16:45:50 +0000 (19:45 +0300)
The original version of the test used netcat along with a standard
AF_UNIX socket, which caused issues across different netcat
implementations. The AF_UNIX socket was then replaced by a FIFO with a
simple echo, which, however, suffers from the same issue (some echo
implementations don't check if the write() was successful).

Let's revert back to the AF_UNIX socket, but replace netcat with socat,
which, hopefully, resolves the main issue.

Relevant commit: 9b45c2bf02a43e3e1b42de1ab0c3fe29c64dc5f5

test/TEST-10-ISSUE-2467/test.sh

index d8959187a1f215fe1b2cb369abba093d1a35aee7..c85433d7d33a6ee39517136c83c4215d9750fb48 100755 (executable)
@@ -17,7 +17,7 @@ test_setup() {
         eval $(udevadm info --export --query=env --name=${LOOPDEV}p2)
 
         setup_basic_environment
-        dracut_install true rm
+        dracut_install true rm socat
 
         # setup the testsuite service
         cat >$initdir/etc/systemd/system/testsuite.service <<'EOF'
@@ -28,13 +28,13 @@ Description=Testsuite service
 Type=oneshot
 StandardOutput=tty
 StandardError=tty
-ExecStart=/bin/sh -e -x -c 'rm -f /tmp/nonexistent; systemctl start test.socket; echo > /run/test.ctl; >/testok'
+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'
 TimeoutStartSec=10s
 EOF
 
        cat  >$initdir/etc/systemd/system/test.socket <<'EOF'
 [Socket]
-ListenFIFO=/run/test.ctl
+ListenStream=/run/test.ctl
 EOF
 
        cat > $initdir/etc/systemd/system/test.service <<'EOF'