From cfd54505eb54e234094258a08b327c0293c0a3e8 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Tue, 16 Jan 2018 18:38:13 +0100 Subject: [PATCH] QmlProfiler: Improve robustness of QmlProfilerTool test The QmlProfilerClientManager will only report connectionClosed() if the connection was open before it dropped. If the connection never opens, that is the hello message never arrives, it will retry a few times, triggering the QTRY_VERIFY timeout. We don't want the retries to succeed, so close the server after the first connection. Furthermore we want the hello message to be transferred before dropping the connection, so check for isConnected(). Change-Id: Ie96c48b2aaf2748d082c4bef3efe85c261ca4812 Reviewed-by: Christian Kandeler --- src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp index f596169cf10..891344cb568 100644 --- a/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp +++ b/src/plugins/qmlprofiler/tests/qmlprofilertool_test.cpp @@ -50,6 +50,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() connect(&server, &QTcpServer::newConnection, this, [&]() { connection.reset(server.nextPendingConnection()); fakeDebugServer(connection.data()); + server.close(); }); QTimer timer; @@ -68,6 +69,7 @@ void QmlProfilerToolTest::testAttachToWaitingApplication() QTRY_VERIFY(connection); QTRY_VERIFY(runControl->isRunning()); + QTRY_VERIFY(profilerTool->clientManager()->isConnected()); connection.reset(); QTRY_VERIFY(runControl->isStopped());