diff options
author | Lars Knoll <lars.knoll@qt.io> | 2019-03-25 12:18:30 +0100 |
---|---|---|
committer | Jędrzej Nowacki <jedrzej.nowacki@qt.io> | 2019-03-27 09:38:20 +0000 |
commit | 4a470101e4b4055eb0cac9143e2b06487f713dc3 (patch) | |
tree | 34d29cdbb988dc1b09d3a5d90c97ade4699a23ec /tests/auto/other/qobjectrace | |
parent | a868412a78c4a9c77beb7990177082eb2e9d17f6 (diff) |
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>
Diffstat (limited to 'tests/auto/other/qobjectrace')
-rw-r--r-- | tests/auto/other/qobjectrace/tst_qobjectrace.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp index 0d656e223c..22782f6b09 100644 --- a/tests/auto/other/qobjectrace/tst_qobjectrace.cpp +++ b/tests/auto/other/qobjectrace/tst_qobjectrace.cpp @@ -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]; } } |