Stabilize Test

Use QProcess::waitForFinished over a signal spy. Has a
chance of stabilizing the test, but also cleans up the code.

Change-Id: I888c3b9da6d44d11516227c085bcc12a5ccb5e8a
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Alan Alpert 2013-04-10 14:18:46 -07:00 committed by The Qt Project
parent ccbf0560b3
commit cbd82ea95e
1 changed files with 2 additions and 4 deletions

View File

@ -110,13 +110,11 @@ void tst_qqmlapplicationengine::application()
*/
QDir::setCurrent(buildDir);
QProcess *testProcess = new QProcess(this);
QTest::ignoreMessage(QtWarningMsg, "Don't know how to handle 'QProcess::ExitStatus', use qRegisterMetaType to register it.");
QSignalSpy processFinished(testProcess, SIGNAL(finished(int,QProcess::ExitStatus)));
QStringList args;
args << QLatin1String("testData");
testProcess->start(QLatin1String("testapp/testapp"), args);
QTRY_VERIFY(processFinished.count());//Application should immediately exit
QCOMPARE(processFinished[0][0].toInt(), 0);
QVERIFY(testProcess->waitForFinished(5000));
QCOMPARE(testProcess->exitCode(), 0);
QByteArray test_stdout = testProcess->readAllStandardOutput();
QByteArray test_stderr = testProcess->readAllStandardError();
QByteArray test_stderr_target("Start: testData\nEnd\n");