]> jfr.im git - irc/znc/znc.git/commitdiff
Increase znc-buildmod timeout in the test.
authorAlexey Sokolov <redacted>
Fri, 19 Apr 2019 11:13:44 +0000 (12:13 +0100)
committerAlexey Sokolov <redacted>
Fri, 19 Apr 2019 11:13:44 +0000 (12:13 +0100)
For some slow systems 30s is too small.

test/integration/framework/base.cpp
test/integration/framework/base.h
test/integration/framework/znctest.cpp
test/integration/tests/core.cpp

index 6d5c66abaef6a75a8a829c4f0aec6cd62c6fdf5b..a7ad8058ad9d1845c7bab6b17332b6307d48f09e 100644 (file)
@@ -45,7 +45,7 @@ Process::Process(QString cmd, QStringList args,
 
 Process::~Process() {
     if (m_kill) m_proc.terminate();
-    bool bFinished = m_proc.waitForFinished();
+    bool bFinished = m_proc.waitForFinished(1000 * m_finishTimeoutSec);
     EXPECT_TRUE(bFinished);
     if (!bFinished) return;
     if (!m_allowDie) {
index 1a0a5fd29b08dc659cd587ce8468da19ca23e69b..41eba8f2ad979d614a5658a29f5dca6417806d9b 100644 (file)
@@ -70,6 +70,7 @@ class Process : public IO<QProcess> {
         m_exit = code;
     }
     void CanDie() { m_allowDie = true; }
+    void ShouldFinishInSec(int sec) { m_finishTimeoutSec = sec; }
 
     // I can't do much about SWIG...
     void CanLeak() { m_allowLeak = true; }
@@ -80,6 +81,7 @@ class Process : public IO<QProcess> {
     bool m_allowDie = false;
     bool m_allowLeak = false;
     QProcess m_proc;
+    int m_finishTimeoutSec = 30;
 };
 
 // Can't use QEventLoop without existing QCoreApplication
index 39492eaefbb20917e772ae76397ebf94d0eeb81c..abdc9b702eafd928a1bd3746b416c6da1c29767d 100644 (file)
@@ -57,9 +57,7 @@ void ZNCTest::SetUp() {
 }
 
 Socket ZNCTest::ConnectIRCd() {
-    [this] {
-        ASSERT_TRUE(m_server.waitForNewConnection(30000 /* msec */));
-    }();
+    [this] { ASSERT_TRUE(m_server.waitForNewConnection(30000 /* msec */)); }();
     return WrapIO(m_server.nextPendingConnection());
 }
 
@@ -84,8 +82,9 @@ Socket ZNCTest::LoginClient() {
 
 std::unique_ptr<Process> ZNCTest::Run() {
     return std::unique_ptr<Process>(new Process(
-        ZNC_BIN_DIR "/znc", QStringList() << "--debug"
-                                          << "--datadir" << m_dir.path(),
+        ZNC_BIN_DIR "/znc",
+        QStringList() << "--debug"
+                      << "--datadir" << m_dir.path(),
         [](QProcess* proc) {
             proc->setProcessChannelMode(QProcess::ForwardedChannels);
         }));
@@ -137,13 +136,13 @@ void ZNCTest::InstallModule(QString name, QString content) {
         QTextStream out(&file);
         out << content;
         file.close();
-        Process p(
-            ZNC_BIN_DIR "/znc-buildmod", QStringList() << file.fileName(),
-            [&](QProcess* proc) {
-                proc->setWorkingDirectory(dir.absolutePath());
-                proc->setProcessChannelMode(QProcess::ForwardedChannels);
-            });
+        Process p(ZNC_BIN_DIR "/znc-buildmod", QStringList() << file.fileName(),
+                  [&](QProcess* proc) {
+                      proc->setWorkingDirectory(dir.absolutePath());
+                      proc->setProcessChannelMode(QProcess::ForwardedChannels);
+                  });
         p.ShouldFinishItself();
+        p.ShouldFinishInSec(300);
     } else if (name.endsWith(".py")) {
         // Dedent
         QStringList lines = content.split("\n");
@@ -151,8 +150,7 @@ void ZNCTest::InstallModule(QString name, QString content) {
         for (const QString& line : lines) {
             int nonspace = line.indexOf(QRegExp("\\S"));
             if (nonspace == -1) continue;
-            if (nonspace < maxoffset || maxoffset == -1)
-                maxoffset = nonspace;
+            if (nonspace < maxoffset || maxoffset == -1) maxoffset = nonspace;
         }
         if (maxoffset == -1) maxoffset = 0;
         QFile file(dir.filePath(name));
@@ -173,5 +171,4 @@ void ZNCTest::InstallModule(QString name, QString content) {
     }
 }
 
-
 }  // namespace znc_inttest
index 08e73066941e33d3531cf5172112349b772722fb..fa927d262a9bf65272ec2206f079f9ad464cdc4c 100644 (file)
@@ -217,6 +217,7 @@ TEST_F(ZNCTest, BuildMod) {
                       proc->setProcessChannelMode(QProcess::ForwardedChannels);
                   });
         p.ShouldFinishItself(1);
+        p.ShouldFinishInSec(300);
     }
     {
         Process p(ZNC_BIN_DIR "/znc-buildmod",
@@ -226,6 +227,7 @@ TEST_F(ZNCTest, BuildMod) {
                       proc->setProcessChannelMode(QProcess::ForwardedChannels);
                   });
         p.ShouldFinishItself();
+        p.ShouldFinishInSec(300);
     }
     client.Write("znc loadmod testmod");
     client.Write("PRIVMSG *testmod :hi");