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 <frederik.gladhorn@qt.io>bb10
parent
eba652a99f
commit
b55a32cd4b
|
|
@ -83,9 +83,10 @@ bool runClient()
|
|||
socket.connectToServer(serverName, QLocalSocket::ReadWrite);
|
||||
if (socket.waitForConnected())
|
||||
break;
|
||||
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");
|
||||
|
|
|
|||
Loading…
Reference in New Issue