diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-22 09:04:55 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2016-07-22 07:21:20 +0000 |
commit | 30eab176fdbc2921d4d1dc754e7f348eb3713dc0 (patch) | |
tree | c94bb39b3c7f143351364a5be709f4861a742b49 /src/plugins/qmlprofiler/tests | |
parent | 16ca70994b4fd630abf184a07cb679a8428f73b5 (diff) |
QmlProfiler: Output unexpected errors in LocalQmlProfiler test
We want to know why it's failing.
Change-Id: I794f183d8aae7f0f7c6444b432d9a2e80db16f22
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Diffstat (limited to 'src/plugins/qmlprofiler/tests')
-rw-r--r-- | src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp index 02518658f3c..830b7101e26 100644 --- a/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp +++ b/src/plugins/qmlprofiler/tests/localqmlprofilerrunner_test.cpp @@ -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; } |