Reduce unnecessary long wait times on failing signal spies

Summary:
Several signal spies, which were supposed to fail, were waiting for the
default 5 seconds, which is most often unnecessary long.

This patch sets a time limit of 500ms in suitable cases. Reduces for me
the total test time by 40%.

Test Plan:
Before (with fixed seat and selection tests):
98% tests passed, 1 tests failed out of 45

Total Test time (real) = 173.31 sec

The following tests FAILED:
         19 - kwayland-testWindowmanagement (Failed)

After:
98% tests passed, 1 tests failed out of 45

Total Test time (real) = 102.12 sec

The following tests FAILED:
         19 - kwayland-testWindowmanagement (Failed)

Reviewers: #plasma, davidedmundson

Reviewed By: #plasma, davidedmundson

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D14184
This commit is contained in:
Roman Gilg 2018-07-17 11:30:16 +02:00
parent d544837e91
commit 7809e83049
6 changed files with 15 additions and 15 deletions

View file

@ -204,7 +204,7 @@ KWayland::Server::SurfaceInterface *TestDragAndDrop::getServerSurface()
if (!surfaceCreatedSpy.isValid()) { if (!surfaceCreatedSpy.isValid()) {
return nullptr; return nullptr;
} }
if (!surfaceCreatedSpy.wait()) { if (!surfaceCreatedSpy.wait(500)) {
return nullptr; return nullptr;
} }
return surfaceCreatedSpy.first().first().value<SurfaceInterface*>(); return surfaceCreatedSpy.first().first().value<SurfaceInterface*>();
@ -389,7 +389,7 @@ void TestDragAndDrop::testDragAndDropWithCancelByDestroyDataSource()
QVERIFY(droppedSpy.isValid()); QVERIFY(droppedSpy.isValid());
m_seatInterface->setTimestamp(4); m_seatInterface->setTimestamp(4);
m_seatInterface->pointerButtonReleased(1); m_seatInterface->pointerButtonReleased(1);
QVERIFY(!droppedSpy.wait()); QVERIFY(!droppedSpy.wait(500));
// verify that we did not get any further input events // verify that we did not get any further input events
QVERIFY(pointerMotionSpy.isEmpty()); QVERIFY(pointerMotionSpy.isEmpty());

View file

@ -213,7 +213,7 @@ void TestPointerConstraints::testLockPointer()
QCOMPARE(serverLockedPointer->lifeTime(), serverLifeTime); QCOMPARE(serverLockedPointer->lifeTime(), serverLifeTime);
// setting to unlocked now should not trigger an unlocked spy // setting to unlocked now should not trigger an unlocked spy
serverLockedPointer->setLocked(false); serverLockedPointer->setLocked(false);
QVERIFY(!unlockedSpy.wait()); QVERIFY(!unlockedSpy.wait(500));
// try setting a region // try setting a region
QSignalSpy destroyedSpy(serverLockedPointer.data(), &QObject::destroyed); QSignalSpy destroyedSpy(serverLockedPointer.data(), &QObject::destroyed);
@ -222,7 +222,7 @@ void TestPointerConstraints::testLockPointer()
QVERIFY(regionChangedSpy.isValid()); QVERIFY(regionChangedSpy.isValid());
lockedPointer->setRegion(m_compositor->createRegion(QRegion(0, 5, 10, 20), m_compositor)); lockedPointer->setRegion(m_compositor->createRegion(QRegion(0, 5, 10, 20), m_compositor));
// it's double buffered // it's double buffered
QVERIFY(!regionChangedSpy.wait()); QVERIFY(!regionChangedSpy.wait(500));
surface->commit(Surface::CommitFlag::None); surface->commit(Surface::CommitFlag::None);
QVERIFY(regionChangedSpy.wait()); QVERIFY(regionChangedSpy.wait());
QCOMPARE(serverLockedPointer->region(), QRegion(0, 5, 10, 20)); QCOMPARE(serverLockedPointer->region(), QRegion(0, 5, 10, 20));
@ -318,7 +318,7 @@ void TestPointerConstraints::testConfinePointer()
QCOMPARE(serverConfinedPointer->lifeTime(), serverLifeTime); QCOMPARE(serverConfinedPointer->lifeTime(), serverLifeTime);
// setting to unconfined now should not trigger an unconfined spy // setting to unconfined now should not trigger an unconfined spy
serverConfinedPointer->setConfined(false); serverConfinedPointer->setConfined(false);
QVERIFY(!unconfinedSpy.wait()); QVERIFY(!unconfinedSpy.wait(500));
// try setting a region // try setting a region
QSignalSpy destroyedSpy(serverConfinedPointer.data(), &QObject::destroyed); QSignalSpy destroyedSpy(serverConfinedPointer.data(), &QObject::destroyed);
@ -327,7 +327,7 @@ void TestPointerConstraints::testConfinePointer()
QVERIFY(regionChangedSpy.isValid()); QVERIFY(regionChangedSpy.isValid());
confinedPointer->setRegion(m_compositor->createRegion(QRegion(0, 5, 10, 20), m_compositor)); confinedPointer->setRegion(m_compositor->createRegion(QRegion(0, 5, 10, 20), m_compositor));
// it's double buffered // it's double buffered
QVERIFY(!regionChangedSpy.wait()); QVERIFY(!regionChangedSpy.wait(500));
surface->commit(Surface::CommitFlag::None); surface->commit(Surface::CommitFlag::None);
QVERIFY(regionChangedSpy.wait()); QVERIFY(regionChangedSpy.wait());
QCOMPARE(serverConfinedPointer->region(), QRegion(0, 5, 10, 20)); QCOMPARE(serverConfinedPointer->region(), QRegion(0, 5, 10, 20));

View file

@ -108,7 +108,7 @@ bool SelectionTest::setupConnection(Connection* c)
c->thread->start(); c->thread->start();
c->connection->initConnection(); c->connection->initConnection();
if (!connectedSpy.wait()) { if (!connectedSpy.wait(500)) {
return false; return false;
} }
@ -126,7 +126,7 @@ bool SelectionTest::setupConnection(Connection* c)
return false; return false;
} }
registry.setup(); registry.setup();
if (!interfacesAnnouncedSpy.wait()) { if (!interfacesAnnouncedSpy.wait(500)) {
return false; return false;
} }
@ -152,7 +152,7 @@ bool SelectionTest::setupConnection(Connection* c)
if (!keyboardSpy.isValid()) { if (!keyboardSpy.isValid()) {
return false; return false;
} }
if (!keyboardSpy.wait()) { if (!keyboardSpy.wait(500)) {
return false; return false;
} }
if (!c->seat->hasKeyboard()) { if (!c->seat->hasKeyboard()) {

View file

@ -199,7 +199,7 @@ SurfaceInterface *TextInputTest::waitForSurface()
if (!surfaceCreatedSpy.isValid()) { if (!surfaceCreatedSpy.isValid()) {
return nullptr; return nullptr;
} }
if (!surfaceCreatedSpy.wait()) { if (!surfaceCreatedSpy.wait(500)) {
return nullptr; return nullptr;
} }
if (surfaceCreatedSpy.count() != 1) { if (surfaceCreatedSpy.count() != 1) {

View file

@ -542,7 +542,7 @@ void TestWaylandSeat::testPointer()
// now a relative motion should not be sent to the relative pointer // now a relative motion should not be sent to the relative pointer
m_seatInterface->relativePointerMotion(QSizeF(1, 2), QSizeF(3, 4), quint64(-1)); m_seatInterface->relativePointerMotion(QSizeF(1, 2), QSizeF(3, 4), quint64(-1));
QVERIFY(!relativeMotionSpy.wait()); QVERIFY(!relativeMotionSpy.wait(500));
// enter it again // enter it again
m_seatInterface->setFocusedPointerSurface(serverSurface, QPoint(0, 0)); m_seatInterface->setFocusedPointerSurface(serverSurface, QPoint(0, 0));
@ -975,7 +975,7 @@ void TestWaylandSeat::testPointerSwipeGesture()
// another start should not be possible // another start should not be possible
m_seatInterface->startPointerSwipeGesture(2); m_seatInterface->startPointerSwipeGesture(2);
QVERIFY(!startSpy.wait()); QVERIFY(!startSpy.wait(500));
// send in some updates // send in some updates
m_seatInterface->setTimestamp(timestamp++); m_seatInterface->setTimestamp(timestamp++);
@ -1091,7 +1091,7 @@ void TestWaylandSeat::testPointerPinchGesture()
// another start should not be possible // another start should not be possible
m_seatInterface->startPointerPinchGesture(3); m_seatInterface->startPointerPinchGesture(3);
QVERIFY(!startSpy.wait()); QVERIFY(!startSpy.wait(500));
// send in some updates // send in some updates
m_seatInterface->setTimestamp(timestamp++); m_seatInterface->setTimestamp(timestamp++);

View file

@ -1143,12 +1143,12 @@ void TestWaylandSurface::testInhibit()
// creating a second idle inhibition should not trigger the signal // creating a second idle inhibition should not trigger the signal
QScopedPointer<IdleInhibitor> inhibitor2(m_idleInhibitManager->createInhibitor(s.data())); QScopedPointer<IdleInhibitor> inhibitor2(m_idleInhibitManager->createInhibitor(s.data()));
QVERIFY(!inhibitsChangedSpy.wait()); QVERIFY(!inhibitsChangedSpy.wait(500));
QCOMPARE(serverSurface->inhibitsIdle(), true); QCOMPARE(serverSurface->inhibitsIdle(), true);
// and also deleting the first inhibitor should not yet change the inhibition // and also deleting the first inhibitor should not yet change the inhibition
inhibitor1.reset(); inhibitor1.reset();
QVERIFY(!inhibitsChangedSpy.wait()); QVERIFY(!inhibitsChangedSpy.wait(500));
QCOMPARE(serverSurface->inhibitsIdle(), true); QCOMPARE(serverSurface->inhibitsIdle(), true);
// but deleting also the second inhibitor should trigger // but deleting also the second inhibitor should trigger