forked from qt-creator/qt-creator
Debugger, QmlProfiler et al: Replace AnalyzerStartParameter
... and QmlProfilerRunner::Configuaration by PE::UrlConnection, and call it 'serverUrl' on the user side. That's the only variant we ever had and avoids "translations" between three structures that are essential the same. Change-Id: I33386b2b8d2a7985ff934f6f8f840de0831bf9c1 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
#include "../qmlprofilerruncontrol.h"
|
||||
|
||||
#include <debugger/analyzer/analyzermanager.h>
|
||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||
|
||||
#include <projectexplorer/runnables.h>
|
||||
|
||||
@@ -63,13 +62,13 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
||||
debuggee.environment = Utils::Environment::systemEnvironment();
|
||||
|
||||
// should not be used anywhere but cannot be empty
|
||||
configuration.socket = connection.analyzerSocket = QString("invalid");
|
||||
serverUrl.setPath("invalid");
|
||||
|
||||
rc = new ProjectExplorer::RunControl(nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
rc->setRunnable(debuggee);
|
||||
rc->setConnection(connection);
|
||||
rc->setConnection(UrlConnection(serverUrl));
|
||||
auto runner = new QmlProfilerRunner(rc);
|
||||
runner->setLocalConfiguration(configuration);
|
||||
runner->setServerUrl(serverUrl);
|
||||
connectRunner(runner);
|
||||
|
||||
rc->initiateStart();
|
||||
@@ -81,7 +80,7 @@ void LocalQmlProfilerRunnerTest::testRunner1()
|
||||
QTRY_COMPARE_WITH_TIMEOUT(runCount, 1, 10000);
|
||||
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
|
||||
|
||||
configuration.socket = connection.analyzerSocket = QmlProfilerRunner::findFreeSocket();
|
||||
serverUrl = UrlConnection::localSocket();
|
||||
|
||||
debuggee.executable = QCoreApplication::applicationFilePath();
|
||||
// comma is used to specify a test function. In this case, an invalid one.
|
||||
@@ -90,9 +89,9 @@ void LocalQmlProfilerRunnerTest::testRunner1()
|
||||
delete rc;
|
||||
rc = new ProjectExplorer::RunControl(nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
rc->setRunnable(debuggee);
|
||||
rc->setConnection(connection);
|
||||
rc->setConnection(serverUrl);
|
||||
auto runner = new QmlProfilerRunner(rc);
|
||||
runner->setLocalConfiguration(configuration);
|
||||
runner->setServerUrl(serverUrl);
|
||||
connectRunner(runner);
|
||||
rc->initiateStart();
|
||||
QTimer::singleShot(0, this, &LocalQmlProfilerRunnerTest::testRunner2);
|
||||
@@ -106,15 +105,12 @@ void LocalQmlProfilerRunnerTest::testRunner2()
|
||||
delete rc;
|
||||
|
||||
debuggee.commandLineArguments.clear();
|
||||
configuration.socket.clear();
|
||||
connection.analyzerSocket.clear();
|
||||
configuration.port = connection.analyzerPort =
|
||||
QmlProfilerRunner::findFreePort(connection.analyzerHost);
|
||||
serverUrl = UrlConnection::localHostAndFreePort();
|
||||
rc = new ProjectExplorer::RunControl(nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||
rc->setRunnable(debuggee);
|
||||
rc->setConnection(connection);
|
||||
rc->setConnection(serverUrl);
|
||||
auto runner = new QmlProfilerRunner(rc);
|
||||
runner->setLocalConfiguration(configuration);
|
||||
runner->setServerUrl(serverUrl);
|
||||
connectRunner(runner);
|
||||
rc->initiateStart();
|
||||
|
||||
@@ -136,17 +132,17 @@ void LocalQmlProfilerRunnerTest::testRunner4()
|
||||
|
||||
void LocalQmlProfilerRunnerTest::testFindFreePort()
|
||||
{
|
||||
QString host;
|
||||
Utils::Port port = QmlProfilerRunner::findFreePort(host);
|
||||
QVERIFY(port.isValid());
|
||||
QVERIFY(!host.isEmpty());
|
||||
QUrl serverUrl = UrlConnection::localHostAndFreePort();
|
||||
QVERIFY(serverUrl.port() != -1);
|
||||
QVERIFY(!serverUrl.host().isEmpty());
|
||||
QTcpServer server;
|
||||
QVERIFY(server.listen(QHostAddress(host), port.number()));
|
||||
QVERIFY(server.listen(QHostAddress(serverUrl.host()), serverUrl.port()));
|
||||
}
|
||||
|
||||
void LocalQmlProfilerRunnerTest::testFindFreeSocket()
|
||||
{
|
||||
QString socket = QmlProfilerRunner::findFreeSocket();
|
||||
QUrl serverUrl = UrlConnection::localSocket();
|
||||
QString socket = serverUrl.path();
|
||||
QVERIFY(!socket.isEmpty());
|
||||
QVERIFY(!QFile::exists(socket));
|
||||
QFile file(socket);
|
||||
|
||||
Reference in New Issue
Block a user