Commit 30eab176 authored by Ulf Hermann's avatar Ulf Hermann

QmlProfiler: Output unexpected errors in LocalQmlProfiler test

We want to know why it's failing.

Change-Id: I794f183d8aae7f0f7c6444b432d9a2e80db16f22
Reviewed-by: Christian Stenger's avatarChristian Stenger <christian.stenger@qt.io>
parent 16ca7099
......@@ -37,6 +37,17 @@ LocalQmlProfilerRunnerTest::LocalQmlProfilerRunnerTest(QObject *parent) : QObjec
{
}
bool checkErrors(const QStringList &errors, int number)
{
if (errors.length() != number) {
qDebug() << "Found unexpected errors:" << errors;
return false;
} else {
return true;
}
}
void LocalQmlProfilerRunnerTest::testRunner()
{
Debugger::AnalyzerConnection connection;
......@@ -53,7 +64,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
bool running = false;
int runCount = 0;
int errors = 0;
QStringList errors;
auto connectRunner = [&]() {
connect(runner, &LocalQmlProfilerRunner::started, this, [&running, &runCount](){
......@@ -68,10 +79,9 @@ void LocalQmlProfilerRunnerTest::testRunner()
connect(runner, &LocalQmlProfilerRunner::appendMessage, this,
[&errors](const QString &message, Utils::OutputFormat format) {
Q_UNUSED(message);
if (format == Utils::ErrorMessageFormat && message !=
ProjectExplorer::ApplicationLauncher::msgWinCannotRetrieveDebuggingOutput())
++errors;
errors << message;
});
};
......@@ -81,7 +91,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
QTRY_COMPARE_WITH_TIMEOUT(runCount, 1, 10000);
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
QCOMPARE(errors, 1);
QVERIFY(checkErrors(errors, 1));
configuration.socket = connection.analyzerSocket = LocalQmlProfilerRunner::findFreeSocket();
configuration.debuggee.executable = qApp->applicationFilePath();
......@@ -99,7 +109,7 @@ void LocalQmlProfilerRunnerTest::testRunner()
QTRY_COMPARE_WITH_TIMEOUT(runCount, 2, 10000);
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
QCOMPARE(errors, 1);
QVERIFY(checkErrors(errors, 1));
delete rc;
......@@ -118,11 +128,11 @@ void LocalQmlProfilerRunnerTest::testRunner()
QTRY_COMPARE_WITH_TIMEOUT(runCount, 3, 10000);
QTest::qWait(1000);
QVERIFY(running); // verify it doesn't spontaneously stop
QCOMPARE(errors, 1);
QVERIFY(checkErrors(errors, 1));
rc->stop();
QTRY_VERIFY_WITH_TIMEOUT(!running, 10000);
QCOMPARE(errors, 2); // "The program has unexpectedly finished."
QVERIFY(checkErrors(errors, 2)); // "The program has unexpectedly finished."
delete rc;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment