Change in kio[master]: Fix CI timeout by killing kioexec while it's sleeping 3 minu...

David Faure (Code Review) noreply at kde.org
Tue Dec 30 08:39:26 UTC 2014


David Faure has uploaded a new change for review.

  https://gerrit.vesnicky.cesnet.cz/r/286

Change subject: Fix CI timeout by killing kioexec while it's sleeping 3 minutes.
......................................................................

Fix CI timeout by killing kioexec while it's sleeping 3 minutes.

Change-Id: Id4d5224dd450d9fa9898cf0ab9fc3d13a1eb63ee
---
M autotests/krununittest.cpp
M autotests/krununittest.h
2 files changed, 14 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.vesnicky.cesnet.cz:29418/kio refs/changes/86/286/1

diff --git a/autotests/krununittest.cpp b/autotests/krununittest.cpp
index 219cbca..73a3932 100644
--- a/autotests/krununittest.cpp
+++ b/autotests/krununittest.cpp
@@ -38,6 +38,9 @@
 #include <kprocess.h>
 #include <KDesktopFile>
 #include "kiotesthelper.h" // createTestFile etc.
+#ifdef Q_OS_UNIX
+#include <signal.h> // kill
+#endif
 
 void KRunUnitTest::initTestCase()
 {
@@ -323,14 +326,14 @@
     srcFile.write("Hello world\n");
 }
 
-void KRunUnitTest::KRunRun_data()
+void KRunUnitTest::KRunRunService_data()
 {
     QTest::addColumn<bool>("tempFile");
 
     QTest::newRow("standard") << false;
     QTest::newRow("tempfile") << true;
 }
-void KRunUnitTest::KRunRun()
+void KRunUnitTest::KRunRunService()
 {
     QFETCH(bool, tempFile);
 
@@ -347,16 +350,20 @@
     QList<QUrl> urls;
     urls.append(QUrl::fromLocalFile(srcFile));
 
-    // When calling KRun::run
-    bool ok = KRun::run(service, urls, 0, tempFile);
+    // When calling KRun::runService
+    qint64 pid = KRun::runService(service, urls, 0, tempFile);
 
     // Then the service should be executed (which copies the source file to "dest")
-    QVERIFY(ok);
+    QVERIFY(pid != 0);
     const QString dest = srcDir + "/dest";
     QTRY_VERIFY(QFile::exists(dest));
     QVERIFY(QFile::exists(srcFile)); // if tempfile is true, kioexec will delete it... in 3 minutes.
 
+    // All done, clean up.
     QVERIFY(QFile::remove(dest));
+#ifdef Q_OS_UNIX
+    ::kill(pid, SIGTERM);
+#endif
 }
 
 QString KRunUnitTest::createTempService()
diff --git a/autotests/krununittest.h b/autotests/krununittest.h
index 23ca977..1f138c1 100644
--- a/autotests/krununittest.h
+++ b/autotests/krununittest.h
@@ -41,8 +41,8 @@
     void testMimeTypeBrokenLink();
     void testMimeTypeDoesNotExist();
 
-    void KRunRun_data();
-    void KRunRun();
+    void KRunRunService_data();
+    void KRunRunService();
 private:
     QString createTempService();
 

-- 
To view, visit https://gerrit.vesnicky.cesnet.cz/r/286
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id4d5224dd450d9fa9898cf0ab9fc3d13a1eb63ee
Gerrit-PatchSet: 1
Gerrit-Project: kio
Gerrit-Branch: master
Gerrit-Owner: David Faure <faure at kde.org>


More information about the Kde-frameworks-devel mailing list