Properly wait for stdout in test
authorUlf Hermann <ulf.hermann@digia.com>
Wed, 29 Jan 2014 15:33:39 +0000 (16:33 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 29 Jan 2014 16:27:55 +0000 (17:27 +0100)
Assuming all output is available on the first readyReadStandardOutput()
signal leads to flaky test results.

Change-Id: I442d7edc905abc067d6c32a4a55afd42ed03e3c9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp

index 9d2e0ecbb451c9b3b64409b4ce75e4f7ed767756..a1228462205194a816035077d699605a3b93bf14 100644 (file)
@@ -406,9 +406,9 @@ void tst_QQmlProfilerService::pixmapCacheData()
     m_client->setTraceState(true);
     QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
 
-    QVERIFY(m_process->output().indexOf(QLatin1String("image loaded")) != -1 ||
-            m_process->output().indexOf(QLatin1String("image error")) != -1 );
-
+    while (m_process->output().indexOf(QLatin1String("image loaded")) == -1 &&
+           m_process->output().indexOf(QLatin1String("image error")) == -1)
+        QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput())));
 
     m_client->setTraceState(false);