path: root/tests/auto/network/socket
diff options
authorKari Oikarinen <>2018-02-26 15:20:08 +0200
committerKari Oikarinen <>2018-02-28 07:06:43 +0000
commitb55a32cd4b432fc7409b8f39c63d84b1a175def7 (patch)
treed29721488ba33178534500bbb69ee07b0c6f5a0b /tests/auto/network/socket
parenteba652a99f602386127e552740fddf5445b3d7c9 (diff)
tst_QLocalSocket: Fix flakiness of processConnection
The test's client processes are prepared for the server not being ready when they try to connect and handle QLocalSocket::ServerNotFoundError by waiting and trying again. However, on Ubuntu 16.04 and 17.10 and possibly other systems, sometimes the error returned by qt_safe_connect inside QLocalSocket is ECONNREFUSED instead of ENOENT. This has caused flaky failures in CI, so wait and try again in the case of QLocalSocket::ConnectionRefusedError also. Task-number: QTBUG-66679 Task-number: QTBUG-66216 Change-Id: I61e3d5b052d84c5ba9d1746f2c71db37cedbf925 Reviewed-by: Frederik Gladhorn <>
Diffstat (limited to 'tests/auto/network/socket')
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp
index 3f2c8abec4..272e837ac5 100644
--- a/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp
+++ b/tests/auto/network/socket/qlocalsocket/socketprocess/main.cpp
@@ -83,9 +83,10 @@ bool runClient()
socket.connectToServer(serverName, QLocalSocket::ReadWrite);
if (socket.waitForConnected())
- if (socket.error() == QLocalSocket::ServerNotFoundError) {
+ if (socket.error() == QLocalSocket::ServerNotFoundError
+ || socket.error() == QLocalSocket::ConnectionRefusedError) {
if (connectTimer.elapsed() > 5000) {
- fprintf(stderr, "client: server not found. Giving up.\n");
+ fprintf(stderr, "client: server not found or connection refused. Giving up.\n");
return false;
printf("client: server not found. Trying again...\n");