mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-22 13:33:56 +03:00
testsuite-77: Fix race condition
Use a socket unit to make sure the socket exists before we start the client that accesses it.
This commit is contained in:
parent
41d125614c
commit
78d774bab4
@ -1,7 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Unit]
|
||||
Description=TEST-77-OPENFILE
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
||||
Type=simple
|
@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
echo "Socket" | nc -lkU /tmp/test.sock
|
6
test/units/testsuite-77-server.socket
Normal file
6
test/units/testsuite-77-server.socket
Normal file
@ -0,0 +1,6 @@
|
||||
[Unit]
|
||||
Description=TEST-77-OPENFILE server socket
|
||||
|
||||
[Socket]
|
||||
ListenStream=/tmp/test.sock
|
||||
Accept=yes
|
7
test/units/testsuite-77-server@.service
Normal file
7
test/units/testsuite-77-server@.service
Normal file
@ -0,0 +1,7 @@
|
||||
[Unit]
|
||||
Description=TEST-77-OPENFILE server
|
||||
|
||||
[Service]
|
||||
ExecStart=echo "Socket"
|
||||
StandardInput=socket
|
||||
StandardOutput=socket
|
@ -1,9 +0,0 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
[Unit]
|
||||
Description=TEST-77-OPENFILE
|
||||
|
||||
[Service]
|
||||
OpenFile=/tmp/test.sock:socket:read-only
|
||||
ExecStartPre=rm -f /failed /testok
|
||||
ExecStart=/usr/lib/systemd/tests/testdata/units/%N.sh
|
||||
Type=oneshot
|
@ -16,8 +16,11 @@ read -r -u 4 text
|
||||
assert_eq "$text" "File"
|
||||
|
||||
# Test for socket
|
||||
systemctl start testsuite-77-netcat.service
|
||||
systemctl start testsuite-77-socket.service
|
||||
systemctl start testsuite-77-server.socket
|
||||
systemd-run -p OpenFile=/tmp/test.sock:socket:read-only \
|
||||
--wait \
|
||||
--pipe \
|
||||
/usr/lib/systemd/tests/testdata/units/testsuite-77-client.sh
|
||||
|
||||
# Tests for D-Bus
|
||||
diff <(systemctl show -p OpenFile testsuite-77) - <<EOF
|
||||
|
Loading…
Reference in New Issue
Block a user