[frameworks/kio] autotests: openurljobtest: wait for the launched processes before ending a test
Méven Car <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 92594ac39daeba6ffe117812055fcde2ae50d6b2 by Méven Car.
Committed on 10/08/2026 at 11:16.
Pushed by meven into branch 'master'.
openurljobtest: wait for the launched processes before ending a test
A KProcessRunner watches its process until it exits, then deletes itself. A
test that ends before that leaves the runner behind, and the CI leak checker
reports it, failing the test even though every case passed. Each case now
waits for the runners to be gone, as applicationlauncherjobtest and
commandlauncherjobtest already do.
M +7 -0 autotests/openurljobtest.cpp
M +1 -0 autotests/openurljobtest.h
https://invent.kde.org/frameworks/kio/-/commit/92594ac39daeba6ffe117812055fcde2ae50d6b2
diff --git a/autotests/openurljobtest.cpp b/autotests/openurljobtest.cpp
index 456c086c1a..0cee9a6e79 100644
--- a/autotests/openurljobtest.cpp
+++ b/autotests/openurljobtest.cpp
@@ -91,6 +91,13 @@ void OpenUrlJobTest::init()
QFile::remove(m_tempDir.path() + "/dest");
}
+void OpenUrlJobTest::cleanup()
+{
+ // A launched process is watched by a runner that deletes itself once the process is gone. A test that
+ // ends before that leaves the runner behind, which the leak checker of the CI reports.
+ QTRY_COMPARE(KProcessRunner::instanceCount(), 0);
+}
+
static void createSrcFile(const QString &path)
{
QFile srcFile(path);
diff --git a/autotests/openurljobtest.h b/autotests/openurljobtest.h
index b874d52e34..4c046b94e1 100644
--- a/autotests/openurljobtest.h
+++ b/autotests/openurljobtest.h
@@ -20,6 +20,7 @@ private Q_SLOTS:
void initTestCase();
void cleanupTestCase();
void init();
+ void cleanup();
void startProcess_data();
void startProcess();