From ac40875ba701d2f5d405bbd652fbe699f074236c Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Thu, 15 Jul 2021 11:19:06 +0300 Subject: [PATCH] QLocalSocket benchmark: improve connectivity and error reporting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../network/socket/qlocalsocket/tst_qlocalsocket.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp b/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp index 406fe741e0d..d7b39ed5662 100644 --- a/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/benchmarks/network/socket/qlocalsocket/tst_qlocalsocket.cpp @@ -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); } }