Stabilize auto test
Don't just wait for 300ms for the thread to finish, this can lead to faling tests esp. on slow hardware. Also fix a mem leak. Change-Id: Ifa90da5507fc6d65ef77e368d7c238271623ff53 Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@qt.io>
This commit is contained in:
parent
a868412a78
commit
4a470101e4
@ -378,6 +378,10 @@ public:
|
||||
connect(timer, &QTimer::timeout, this, &DeleteReceiverRaceReceiver::onTimeout);
|
||||
timer->start(1);
|
||||
}
|
||||
~DeleteReceiverRaceReceiver()
|
||||
{
|
||||
delete receiver;
|
||||
}
|
||||
|
||||
void onTimeout()
|
||||
{
|
||||
@ -428,12 +432,12 @@ void tst_QObjectRace::disconnectRace()
|
||||
|
||||
for (int i = 0; i < ThreadCount; ++i) {
|
||||
threads[i]->requestInterruption();
|
||||
QVERIFY(threads[i]->wait(300));
|
||||
QVERIFY(threads[i]->wait());
|
||||
delete threads[i];
|
||||
}
|
||||
|
||||
senderThread->quit();
|
||||
QVERIFY(senderThread->wait(300));
|
||||
QVERIFY(senderThread->wait());
|
||||
}
|
||||
|
||||
QCOMPARE(countedStructObjectsCount.load(), 0u);
|
||||
@ -453,11 +457,11 @@ void tst_QObjectRace::disconnectRace()
|
||||
QTest::qWait(TimeLimit);
|
||||
|
||||
senderThread->requestInterruption();
|
||||
QVERIFY(senderThread->wait(300));
|
||||
QVERIFY(senderThread->wait());
|
||||
|
||||
for (int i = 0; i < ThreadCount; ++i) {
|
||||
threads[i]->quit();
|
||||
QVERIFY(threads[i]->wait(300));
|
||||
QVERIFY(threads[i]->wait());
|
||||
delete threads[i];
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user