QLocalSocket benchmark: improve connectivity and error reporting

For nonblocking Unix domain sockets the connection may not be
completed immediately. So, add a blocking call to waitForConnected()
to improve test stability. Also, explain a possible reason that
cause the connection to fail on Unix.

Task-number: QTBUG-91713
Change-Id: If34070f2383fd0c854e2707c734fe5da4bda1b42
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Alex Trotsenko 2021-07-15 11:19:06 +03:00
parent 2f4868548b
commit ac40875ba7

View File

@ -116,6 +116,10 @@ public:
});
socket->connectToServer("foo");
QVERIFY2(socket->waitForConnected(), "The system is probably reaching the maximum "
"number of open file descriptors. On Unix, "
"try to increase the limit with 'ulimit -n 32000' "
"and run the test again.");
QCOMPARE(socket->state(), QLocalSocket::ConnectedState);
}
}