summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2021-05-18 17:48:02 +0200
committerIvan Solovev <ivan.solovev@qt.io>2021-05-21 17:09:03 +0200
commit97dc5bdcc7d98e2c2174af7af880a0bc015e2fa8 (patch)
treeb2db478055d66a61f587548123bcea82b95d26c1
parent86c28b98bd024221b3e5eac971ac5641ac09e1a9 (diff)
downloadqtlocation-97dc5bdcc7d98e2c2174af7af880a0bc015e2fa8.tar.gz
QtPositioning tests: reduce timeouts
The tests for QGeoPositionInfoSource and QGeoSatelliteInfoSource had the updated intervals of 7000 msec and more. According to the comments in the code, initially it was caused by the symbian emulator, that had a minimumUpdateInterval of 5000 msec. Currently this emulator is not used in our CI, and the minimumUpdateInterval for all existing plugins is not greater than 1000 msec. This patch reduces all the intervals, which allows to reduce the total test execution time by more than 3 times (from 930+ seconds to around 270 seconds on my local machine). Note: this patch does not change the timeouts in the QTRY_*_WITH_TIMEOUT calls, because they do not always stay blocked for the whole specified timeout. Keeping large timeouts will prevent the tests from flaky failing due to I/O operations being slow in case of high CI load. Fixes: QTBUG-93030 Change-Id: I0fac431448b435302dec050a9448d31e1345b287 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Juha Vuolle <juha.vuolle@insta.fi> Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
-rw-r--r--tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp57
-rw-r--r--tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp46
2 files changed, 51 insertions, 52 deletions
diff --git a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
index 48b8fb0a..2ddcc9a0 100644
--- a/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
+++ b/tests/auto/qgeopositioninfosource/testqgeopositioninfosource.cpp
@@ -323,8 +323,7 @@ void TestQGeoPositionInfoSource::lastKnownPosition()
QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- int time_out = 7000;
- m_source->setUpdateInterval(time_out);
+ m_source->setUpdateInterval(1000);
m_source->startUpdates();
// Use QEventLoop instead of qWait() to ensure we stop as soon as a
@@ -420,14 +419,14 @@ void TestQGeoPositionInfoSource::startUpdates_testIntervals()
CHECK_SOURCE_VALID;
QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(7000);
- int interval = m_source->updateInterval();
+ m_source->setUpdateInterval(1000);
+ const int interval = 15000;
m_source->startUpdates();
- QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, 9500);
+ QTRY_COMPARE_WITH_TIMEOUT(spy.count(), 1, interval);
for (int i = 0; i < 6; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1) && (timeout.count() == 0), (interval*2));
+ QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 1) && (timeout.count() == 0), interval);
spy.clear();
}
@@ -441,9 +440,6 @@ void TestQGeoPositionInfoSource::startUpdates_testIntervalChangesWhileRunning()
// The interval can be changed will running or after the next update.
// WinCE uses the first method, S60 uses the second method.
- // The minimum interval on the symbian emulator is 5000 msecs, which is why the times in
- // this test are as high as they are.
-
CHECK_SOURCE_VALID;
QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
@@ -452,26 +448,26 @@ void TestQGeoPositionInfoSource::startUpdates_testIntervalChangesWhileRunning()
m_source->startUpdates();
m_source->setUpdateInterval(0);
- QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 7000);
+ QTRY_VERIFY_WITH_TIMEOUT(spy.count() > 0, 3000);
QCOMPARE(timeout.count(), 0);
spy.clear();
- m_source->setUpdateInterval(5000);
+ m_source->setUpdateInterval(1000);
QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
spy.clear();
- m_source->setUpdateInterval(10000);
+ m_source->setUpdateInterval(2000);
QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 30000);
spy.clear();
- m_source->setUpdateInterval(5000);
+ m_source->setUpdateInterval(1000);
QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
spy.clear();
- m_source->setUpdateInterval(5000);
+ m_source->setUpdateInterval(1000);
QTRY_VERIFY_WITH_TIMEOUT((spy.count() == 2) && (timeout.count() == 0), 15000);
spy.clear();
@@ -546,14 +542,14 @@ void TestQGeoPositionInfoSource::stopUpdates()
QSignalSpy spy(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy timeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(7000);
+ m_source->setUpdateInterval(1000);
m_source->startUpdates();
for (int i = 0; i < 2; i++) {
QTRY_VERIFY_WITH_TIMEOUT((spy.count() > 0) && (timeout.count() == 0), 9500);
spy.clear();
}
m_source->stopUpdates();
- QTest::qWait(9500);
+ QTest::qWait(2000);
QCOMPARE(spy.count(), 0);
spy.clear();
@@ -596,7 +592,8 @@ void TestQGeoPositionInfoSource::requestUpdate_validTimeout()
QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(7000);
+ // currently all the sources have a minimumUpdateInterval <= 1000
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
}
@@ -635,11 +632,12 @@ void TestQGeoPositionInfoSource::requestUpdate_repeatedCalls()
QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(7000);
+ // currently all the sources have a minimumUpdateInterval <= 1000
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
spyUpdate.clear();
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
}
@@ -651,8 +649,9 @@ void TestQGeoPositionInfoSource::requestUpdate_overlappingCalls()
QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(7000);
- m_source->requestUpdate(7000);
+ // currently all the sources have a minimumUpdateInterval <= 1000
+ m_source->requestUpdate(1500);
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
}
@@ -671,7 +670,7 @@ void TestQGeoPositionInfoSource::requestUpdateAfterStartUpdates_ZeroInterval()
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
spyUpdate.clear();
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
QTest::qWait(7000);
QVERIFY((spyUpdate.count() > 0) && (spyTimeout.count() == 0));
@@ -689,13 +688,13 @@ void TestQGeoPositionInfoSource::requestUpdateAfterStartUpdates_SmallInterval()
QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->setUpdateInterval(10000);
+ m_source->setUpdateInterval(2000);
m_source->startUpdates();
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 20000);
spyUpdate.clear();
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() == 1) && (spyTimeout.count() == 0), 7000);
spyUpdate.clear();
@@ -712,7 +711,7 @@ void TestQGeoPositionInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
m_source->setUpdateInterval(0);
m_source->startUpdates();
@@ -720,7 +719,7 @@ void TestQGeoPositionInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() >= 2) && (spyTimeout.count() == 0), 14000);
spyUpdate.clear();
- QTest::qWait(7000);
+ QTest::qWait(1500);
QCOMPARE(spyTimeout.count(), 0);
@@ -733,9 +732,9 @@ void TestQGeoPositionInfoSource::requestUpdateBeforeStartUpdates_SmallInterval()
QSignalSpy spyUpdate(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)));
QSignalSpy spyTimeout(m_source, SIGNAL(errorOccurred(QGeoPositionInfoSource::Error)));
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
- m_source->setUpdateInterval(10000);
+ m_source->setUpdateInterval(3000);
m_source->startUpdates();
QTRY_VERIFY_WITH_TIMEOUT((spyUpdate.count() > 0) && (spyTimeout.count() == 0), 7000);
@@ -775,7 +774,7 @@ void TestQGeoPositionInfoSource::removeSlotForPositionUpdated()
i = disconnect(m_source, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(test_slot1()));
QVERIFY(i == true);
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((m_testSlot2Called == true), 7000);
}
diff --git a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
index 2fc35d6a..f4a5c6ee 100644
--- a/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
+++ b/tests/auto/qgeosatelliteinfosource/testqgeosatelliteinfosource.cpp
@@ -242,17 +242,17 @@ void TestQGeoSatelliteInfoSource::startUpdates_testIntervals()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->setUpdateInterval(7000);
- int interval = m_source->updateInterval();
+ m_source->setUpdateInterval(1000);
+ const int interval = 10000;
m_source->startUpdates();
if (!errorSpy.isEmpty())
QSKIP("Error starting satellite updates.");
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 9500);
+ QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), interval);
for (int i = 0; i < 6; i++) {
- QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1) && (errorSpy.count() == 0), (interval*2));
+ QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1) && (errorSpy.count() == 0), interval);
spyView.clear();
spyUse.clear();
}
@@ -288,25 +288,25 @@ void TestQGeoSatelliteInfoSource::startUpdates_testIntervalChangesWhileRunning()
spyView.clear();
spyUse.clear();
- m_source->setUpdateInterval(5000);
+ m_source->setUpdateInterval(1000);
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
spyView.clear();
spyUse.clear();
- m_source->setUpdateInterval(10000);
+ m_source->setUpdateInterval(2000);
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 30000);
spyView.clear();
spyUse.clear();
- m_source->setUpdateInterval(5000);
+ m_source->setUpdateInterval(1000);
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
spyView.clear();
spyUse.clear();
- m_source->setUpdateInterval(5000);
+ m_source->setUpdateInterval(1000);
QTRY_VERIFY_WITH_TIMEOUT( (spyView.count() == 2) && (spyUse.count() == 2) && (errorSpy.count() == 0), 15000);
spyView.clear();
@@ -405,7 +405,7 @@ void TestQGeoSatelliteInfoSource::stopUpdates()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->setUpdateInterval(10000);
+ m_source->setUpdateInterval(1000);
m_source->startUpdates();
if (!errorSpy.isEmpty())
@@ -473,7 +473,7 @@ void TestQGeoSatelliteInfoSource::requestUpdate_validTimeout()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
if (!errorSpy.isEmpty())
QSKIP("Error starting satellite updates.");
@@ -525,7 +525,7 @@ void TestQGeoSatelliteInfoSource::requestUpdate_repeatedCalls()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
if (!errorSpy.isEmpty())
QSKIP("Error starting satellite updates.");
@@ -534,7 +534,7 @@ void TestQGeoSatelliteInfoSource::requestUpdate_repeatedCalls()
spyView.clear();
spyUse.clear();
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
}
@@ -549,12 +549,12 @@ void TestQGeoSatelliteInfoSource::requestUpdate_overlappingCalls()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
if (!errorSpy.isEmpty())
QSKIP("Error starting satellite updates.");
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() == 1) && (spyUse.count() == 1), 7000);
}
@@ -601,7 +601,7 @@ void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_ZeroInterval()
spyView.clear();
spyUse.clear();
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() >= 1) && (spyUse.count() >= 1)
&& (errorSpy.count() == 0), 7000);
@@ -624,8 +624,8 @@ void TestQGeoSatelliteInfoSource::requestUpdateAfterStartUpdates_SmallInterval()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->setUpdateInterval(10000);
- m_source->requestUpdate(7000);
+ m_source->setUpdateInterval(3000);
+ m_source->requestUpdate(1500);
if (!errorSpy.isEmpty())
QSKIP("Error starting satellite updates.");
@@ -652,7 +652,7 @@ void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
if (!errorSpy.isEmpty())
QSKIP("Error starting satellite updates.");
@@ -664,7 +664,7 @@ void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_ZeroInterval()
spyView.clear();
spyUse.clear();
- QTest::qWait(7000);
+ QTest::qWait(1500);
QCOMPARE(errorSpy.count(), 0);
@@ -680,12 +680,12 @@ void TestQGeoSatelliteInfoSource::requestUpdateBeforeStartUpdates_SmallInterval(
SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)));
QSignalSpy errorSpy(m_source, SIGNAL(errorOccurred(QGeoSatelliteInfoSource::Error)));
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
if (!errorSpy.isEmpty())
QSKIP("Error starting satellite updates.");
- m_source->setUpdateInterval(10000);
+ m_source->setUpdateInterval(2000);
m_source->startUpdates();
QTRY_VERIFY_WITH_TIMEOUT((spyView.count() > 0) && (spyUse.count() > 0) && (errorSpy.count() == 0), 7000);
@@ -728,7 +728,7 @@ void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInUseUpdated()
i = disconnect(m_source, SIGNAL(satellitesInUseUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
QVERIFY(i == true);
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
if (m_source->error() != QGeoSatelliteInfoSource::NoError)
QSKIP("Error starting satellite updates.");
@@ -747,7 +747,7 @@ void TestQGeoSatelliteInfoSource::removeSlotForSatellitesInViewUpdated()
i = disconnect(m_source, SIGNAL(satellitesInViewUpdated(QList<QGeoSatelliteInfo>)), this, SLOT(test_slot1()));
QVERIFY(i == true);
- m_source->requestUpdate(7000);
+ m_source->requestUpdate(1500);
if (m_source->error() != QGeoSatelliteInfoSource::NoError)
QSKIP("Error starting satellite updates.");