commit:     08a1fe0c24a75683febdfa101705550052bff99d
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Mon Apr 18 20:36:58 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Mon Apr 18 20:37:14 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=08a1fe0c

kde-frameworks/krunner: Try to fix runnermanagertest

Bug: https://bugs.gentoo.org/838502
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 ...er-5.92.0-drop-runnermanagertest-timeouts.patch | 55 ++++++++++++++++++++++
 ...5.92.0-increase-runnermanagertest-timeout.patch | 26 ++++++++++
 kde-frameworks/krunner/krunner-5.92.0.ebuild       |  5 ++
 3 files changed, 86 insertions(+)

diff --git 
a/kde-frameworks/krunner/files/krunner-5.92.0-drop-runnermanagertest-timeouts.patch
 
b/kde-frameworks/krunner/files/krunner-5.92.0-drop-runnermanagertest-timeouts.patch
new file mode 100644
index 000000000000..1d6c654f631e
--- /dev/null
+++ 
b/kde-frameworks/krunner/files/krunner-5.92.0-drop-runnermanagertest-timeouts.patch
@@ -0,0 +1,55 @@
+From f324dd5fc477888517db7b431bc291d0712969af Mon Sep 17 00:00:00 2001
+From: Eduardo de Souza Cruz <eduardo.c...@kdemail.net>
+Date: Mon, 14 Mar 2022 14:12:17 -0300
+Subject: [PATCH] Remove upper-limits for RunnerManagerTest's timeouts
+
+Those upper-limits timeouts were not conservative enough for the Continuous 
Integration environment which can be slow and this test was failing sometimes.
+
+The upper-limits timing verifications were removed without too much prejudice 
to the overall test. It should still serve its purpose to guarantee there will 
be no regression on this functionality.
+---
+ autotests/runnermanagertest.cpp | 13 ++++++-------
+ 1 file changed, 6 insertions(+), 7 deletions(-)
+
+diff --git a/autotests/runnermanagertest.cpp b/autotests/runnermanagertest.cpp
+index 02c0985..82bd2a4 100644
+--- a/autotests/runnermanagertest.cpp
++++ b/autotests/runnermanagertest.cpp
+@@ -74,8 +74,9 @@ private Q_SLOTS:
+         // However not yet a matcheschanged, it should be stalled for 250ms
+         QCOMPARE(spyMatchesChanged.count(), 0);
+ 
+-        // After 250ms it will emit with empty matches, we wait for that
+-        QVERIFY(spyMatchesChanged.wait(265)); // 265ms as a margin of safety 
for 250ms
++        // After 250ms it will emit with empty matches, we wait for that.
++        // We can't put a low upper limit on these wait() calls because the 
CI environment can be slow.
++        QVERIFY(spyMatchesChanged.wait()); // This should take just a tad 
longer than 250ms.
+ 
+         // This should have taken no less than 250ms. It waits for 250s 
before "giving up" and emitting an empty matches list.
+         QVERIFY(timer.elapsed() >= 250);
+@@ -84,20 +85,18 @@ private Q_SLOTS:
+         QCOMPARE(spyQueryFinished.count(), 1); // Still the same, query is 
not done
+ 
+         // We programmed it to emit the result after 300ms, so we need to 
wait 50ms more for the next emission
+-        QVERIFY(spyQueryFinished.wait(100)); // 100ms as a margin of safety 
for 50ms
++        QVERIFY(spyQueryFinished.wait());
+ 
+         // This should have taken at least 300ms total, as we requested via 
the special query string
+         QVERIFY(timer.elapsed() >= 300);
+ 
+-        // RunnerManager::jobDone() should have anticipated the final 
emission, so it should not have waited the full 250+250 ms.
+-        QVERIFY(timer.elapsed() <= 330); // This total should be just a tad 
bigger than 300ms, we put a 10% margin of safety
+-
++        // At this point RunnerManager::jobDone() should have anticipated the 
final emission.
+         QCOMPARE(spyMatchesChanged.count(), 2); // We had the second 
matchesChanged emission, now with the query result
+         QCOMPARE(manager->matches().count(), 1); // The result is here
+         QCOMPARE(spyQueryFinished.count(), 2); // Will have emited 
queryFinished, job is done
+ 
+         // Now we will make sure that RunnerManager::scheduleMatchesChanged() 
emits matchesChanged instantly
+-        // if we start a query with an empty string. It will never produce 
results, stalling is meaninless
++        // if we start a query with an empty string. It will never produce 
results, stalling is meaningless
+         manager->launchQuery("");
+         QCOMPARE(spyMatchesChanged.count(), 3); // One more, instantly, 
without stall
+         QCOMPARE(manager->matches().count(), 0); // Empty results for empty 
query string
+-- 
+GitLab
+

diff --git 
a/kde-frameworks/krunner/files/krunner-5.92.0-increase-runnermanagertest-timeout.patch
 
b/kde-frameworks/krunner/files/krunner-5.92.0-increase-runnermanagertest-timeout.patch
new file mode 100644
index 000000000000..7a586598c15e
--- /dev/null
+++ 
b/kde-frameworks/krunner/files/krunner-5.92.0-increase-runnermanagertest-timeout.patch
@@ -0,0 +1,26 @@
+From c1f589a7cda3a5d47479ab1188716df533ceb8b1 Mon Sep 17 00:00:00 2001
+From: David Faure <fa...@kde.org>
+Date: Sun, 13 Mar 2022 13:08:26 +0100
+Subject: [PATCH] autotests: urgh, this test is really timing dependent, and
+ fails if CI is slow
+
+---
+ autotests/runnermanagertest.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/autotests/runnermanagertest.cpp b/autotests/runnermanagertest.cpp
+index b9ccbc5..02c0985 100644
+--- a/autotests/runnermanagertest.cpp
++++ b/autotests/runnermanagertest.cpp
+@@ -84,7 +84,7 @@ private Q_SLOTS:
+         QCOMPARE(spyQueryFinished.count(), 1); // Still the same, query is 
not done
+ 
+         // We programmed it to emit the result after 300ms, so we need to 
wait 50ms more for the next emission
+-        QVERIFY(spyQueryFinished.wait(65)); // 65ms as a margin of safety for 
50ms
++        QVERIFY(spyQueryFinished.wait(100)); // 100ms as a margin of safety 
for 50ms
+ 
+         // This should have taken at least 300ms total, as we requested via 
the special query string
+         QVERIFY(timer.elapsed() >= 300);
+-- 
+GitLab
+

diff --git a/kde-frameworks/krunner/krunner-5.92.0.ebuild 
b/kde-frameworks/krunner/krunner-5.92.0.ebuild
index 2f9c5b2e8930..27d1116f2d8a 100644
--- a/kde-frameworks/krunner/krunner-5.92.0.ebuild
+++ b/kde-frameworks/krunner/krunner-5.92.0.ebuild
@@ -31,6 +31,11 @@ DEPEND="
 "
 RDEPEND="${DEPEND}"
 
+PATCHES=(
+       "${FILESDIR}/${P}-increase-runnermanagertest-timeout.patch"
+       "${FILESDIR}/${P}-drop-runnermanagertest-timeouts.patch"
+)
+
 src_configure() {
        local mycmakeargs=(
                $(cmake_use_find_package activities KF5Activities)

Reply via email to