[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kio] autotests: Fix CI timeout by killing kioexec while it's sleeping 3 minutes.
From:       David Faure <faure () kde ! org>
Date:       2014-12-31 23:25:14
Message-ID: E1Y6Sde-0007xE-8s () scm ! kde ! org
[Download RAW message or body]

Git commit 6478957bf022b8ee22a5efec37a1a070e406c762 by David Faure.
Committed on 30/12/2014 at 08:38.
Pushed by dfaure into branch 'master'.

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

Change-Id: Id4d5224dd450d9fa9898cf0ab9fc3d13a1eb63ee

M  +12   -5    autotests/krununittest.cpp
M  +2    -2    autotests/krununittest.h

http://commits.kde.org/kio/6478957bf022b8ee22a5efec37a1a070e406c762

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 @@ QTEST_GUILESS_MAIN(KRunUnitTest)
 #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 @@ static void createSrcFile(const QString path)
     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 @@ void KRunUnitTest::KRunRun()
     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 @@ private Q_SLOTS:
     void testMimeTypeBrokenLink();
     void testMimeTypeDoesNotExist();
 
-    void KRunRun_data();
-    void KRunRun();
+    void KRunRunService_data();
+    void KRunRunService();
 private:
     QString createTempService();
 

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic