Fixed tst_qprocess, tst_qtcpserver when crashing is slow

These tests assumed that a crashing program will always exit within
five seconds.  This is not true in some situations.  On our test macs,
enabling crash dumps can easily cause a process to take longer than
five seconds to crash.

Increased the timeout to 30 seconds.

Change-Id: Ifca240ac8d3da1346f33110653ac47de6ba2ab81
Reviewed-on: http://codereview.qt.nokia.com/2407
Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
This commit is contained in:
Rohan McGovern 2011-08-01 10:17:51 +10:00 committed by Qt by Nokia
parent 9d16ae8d2c
commit 30eff894d9
2 changed files with 4 additions and 4 deletions

View File

@ -335,7 +335,7 @@ void tst_QProcess::crashTest()
QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError))); QSignalSpy spy(process, SIGNAL(error(QProcess::ProcessError)));
QSignalSpy spy2(process, SIGNAL(finished(int, QProcess::ExitStatus))); QSignalSpy spy2(process, SIGNAL(finished(int, QProcess::ExitStatus)));
QVERIFY(process->waitForFinished(5000)); QVERIFY(process->waitForFinished(30000));
QCOMPARE(spy.count(), 1); QCOMPARE(spy.count(), 1);
QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy.at(0).at(0).constData()), QProcess::Crashed); QCOMPARE(*static_cast<const QProcess::ProcessError *>(spy.at(0).at(0).constData()), QProcess::Crashed);
@ -372,7 +372,7 @@ void tst_QProcess::crashTest2()
QObject::connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot())); QObject::connect(process, SIGNAL(finished(int)), this, SLOT(exitLoopSlot()));
QTestEventLoop::instance().enterLoop(5); QTestEventLoop::instance().enterLoop(30);
if (QTestEventLoop::instance().timeout()) if (QTestEventLoop::instance().timeout())
QFAIL("Failed to detect crash : operation timed out"); QFAIL("Failed to detect crash : operation timed out");
@ -673,7 +673,7 @@ void tst_QProcess::exitStatus()
for (int i = 0; i < processList.count(); ++i) { for (int i = 0; i < processList.count(); ++i) {
process->start(processList.at(i)); process->start(processList.at(i));
QVERIFY(process->waitForStarted(5000)); QVERIFY(process->waitForStarted(5000));
QVERIFY(process->waitForFinished(5000)); QVERIFY(process->waitForFinished(30000));
QCOMPARE(process->exitStatus(), exitStatus.at(i)); QCOMPARE(process->exitStatus(), exitStatus.at(i));
} }

View File

@ -575,7 +575,7 @@ void tst_QTcpServer::addressReusable()
socket.connectToHost(QHostAddress::LocalHost, 49199); socket.connectToHost(QHostAddress::LocalHost, 49199);
QVERIFY(socket.waitForConnected(5000)); QVERIFY(socket.waitForConnected(5000));
QVERIFY(process.waitForFinished(5000)); QVERIFY(process.waitForFinished(30000));
// Give the system some time. // Give the system some time.
QTest::qSleep(10); QTest::qSleep(10);