From kde-commits Wed Dec 31 23:25:14 2014 From: David Faure Date: Wed, 31 Dec 2014 23:25:14 +0000 To: kde-commits Subject: [kio] autotests: Fix CI timeout by killing kioexec while it's sleeping 3 minutes. Message-Id: X-MARC-Message: https://marc.info/?l=kde-commits&m=142006832508799 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 #include #include "kiotesthelper.h" // createTestFile etc. +#ifdef Q_OS_UNIX +#include // 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("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 urls; urls.append(QUrl::fromLocalFile(srcFile)); = - // When calling KRun::run - bool ok =3D KRun::run(service, urls, 0, tempFile); + // When calling KRun::runService + qint64 pid =3D KRun::runService(service, urls, 0, tempFile); = // Then the service should be executed (which copies the source file t= o "dest") - QVERIFY(ok); + QVERIFY(pid !=3D 0); const QString dest =3D 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(); =