forked from qt-creator/qt-creator
QmlProfiler: Fix LocalQmlProfilerRunner test for windows
Start the process with valid environment, connection, configuration, and better suited arguments, and re-enable the test. Change-Id: I4ff92ab60d46f3a96a1eb7c8414abf0fc56e8b26 Task-number: QTCREATORBUG-16436 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
@@ -27,7 +27,6 @@
|
|||||||
#include <debugger/analyzer/analyzermanager.h>
|
#include <debugger/analyzer/analyzermanager.h>
|
||||||
#include <debugger/analyzer/analyzerruncontrol.h>
|
#include <debugger/analyzer/analyzerruncontrol.h>
|
||||||
#include <debugger/analyzer/analyzerstartparameters.h>
|
#include <debugger/analyzer/analyzerstartparameters.h>
|
||||||
#include <utils/hostosinfo.h>
|
|
||||||
#include <QtTest>
|
#include <QtTest>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
|
|
||||||
@@ -40,13 +39,16 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec
|
|||||||
|
|
||||||
void LocalQmlProfilerRunnerTest::testRunner()
|
void LocalQmlProfilerRunnerTest::testRunner()
|
||||||
{
|
{
|
||||||
if (Utils::HostOsInfo::isWindowsHost())
|
Debugger::AnalyzerConnection connection;
|
||||||
QSKIP("This test is disabled on Windows as it produces a blocking dialog.");
|
|
||||||
|
|
||||||
LocalQmlProfilerRunner::Configuration configuration;
|
LocalQmlProfilerRunner::Configuration configuration;
|
||||||
|
configuration.debuggee.environment = Utils::Environment::systemEnvironment();
|
||||||
|
|
||||||
|
// should not be used anywhere but cannot be empty
|
||||||
|
configuration.socket = connection.analyzerSocket = QString("invalid");
|
||||||
|
|
||||||
Debugger::AnalyzerRunControl *rc = Debugger::createAnalyzerRunControl(
|
Debugger::AnalyzerRunControl *rc = Debugger::createAnalyzerRunControl(
|
||||||
nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
rc->setConnection(Debugger::AnalyzerConnection());
|
rc->setConnection(connection);
|
||||||
auto runner = new LocalQmlProfilerRunner(configuration, rc);
|
auto runner = new LocalQmlProfilerRunner(configuration, rc);
|
||||||
|
|
||||||
bool running = false;
|
bool running = false;
|
||||||
@@ -67,7 +69,8 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
connect(runner, &LocalQmlProfilerRunner::appendMessage, this,
|
connect(runner, &LocalQmlProfilerRunner::appendMessage, this,
|
||||||
[&errors](const QString &message, Utils::OutputFormat format) {
|
[&errors](const QString &message, Utils::OutputFormat format) {
|
||||||
Q_UNUSED(message);
|
Q_UNUSED(message);
|
||||||
if (format == Utils::ErrorMessageFormat)
|
if (format == Utils::ErrorMessageFormat && message !=
|
||||||
|
ProjectExplorer::ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput())
|
||||||
++errors;
|
++errors;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -80,14 +83,16 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
|
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
|
||||||
QCOMPARE(errors, 1);
|
QCOMPARE(errors, 1);
|
||||||
|
|
||||||
configuration.debuggee.environment = Utils::Environment::systemEnvironment();
|
configuration.socket = connection.analyzerSocket = LocalQmlProfilerRunner::findFreeSocket();
|
||||||
configuration.debuggee.executable = qApp->applicationFilePath();
|
configuration.debuggee.executable = qApp->applicationFilePath();
|
||||||
configuration.debuggee.commandLineArguments = QString("-version");
|
|
||||||
|
// comma is used to specify a test function. In this case, an invalid one.
|
||||||
|
configuration.debuggee.commandLineArguments = QString("-test QmlProfiler,");
|
||||||
|
|
||||||
delete rc;
|
delete rc;
|
||||||
rc = Debugger::createAnalyzerRunControl(
|
rc = Debugger::createAnalyzerRunControl(
|
||||||
nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
rc->setConnection(Debugger::AnalyzerConnection());
|
rc->setConnection(connection);
|
||||||
runner = new LocalQmlProfilerRunner(configuration, rc);
|
runner = new LocalQmlProfilerRunner(configuration, rc);
|
||||||
connectRunner();
|
connectRunner();
|
||||||
rc->start();
|
rc->start();
|
||||||
@@ -99,9 +104,13 @@ void LocalQmlProfilerRunnerTest::testRunner()
|
|||||||
delete rc;
|
delete rc;
|
||||||
|
|
||||||
configuration.debuggee.commandLineArguments.clear();
|
configuration.debuggee.commandLineArguments.clear();
|
||||||
|
configuration.socket.clear();
|
||||||
|
connection.analyzerSocket.clear();
|
||||||
|
configuration.port = connection.analyzerPort =
|
||||||
|
LocalQmlProfilerRunner::findFreePort(connection.analyzerHost);
|
||||||
rc = Debugger::createAnalyzerRunControl(
|
rc = Debugger::createAnalyzerRunControl(
|
||||||
nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
nullptr, ProjectExplorer::Constants::QML_PROFILER_RUN_MODE);
|
||||||
rc->setConnection(Debugger::AnalyzerConnection());
|
rc->setConnection(connection);
|
||||||
runner = new LocalQmlProfilerRunner(configuration, rc);
|
runner = new LocalQmlProfilerRunner(configuration, rc);
|
||||||
connectRunner();
|
connectRunner();
|
||||||
rc->start();
|
rc->start();
|
||||||
|
Reference in New Issue
Block a user