qt: Increase timeout when waiting for signals.
authorJustus Winter <justus@g10code.com>
Tue, 31 Jan 2017 09:47:00 +0000 (10:47 +0100)
committerJustus Winter <justus@g10code.com>
Tue, 31 Jan 2017 09:47:00 +0000 (10:47 +0100)
* lang/qt/tests/t-support.h (QSIGNALSPY_TIMEOUT): New macro.
* lang/qt/tests/t-encrypt.cpp: Use the new macro as timeout when
waiting for signals.
* lang/qt/tests/t-keylist.cpp: Likewise.
* lang/qt/tests/t-keylocate.cpp: Likewise.
* lang/qt/tests/t-ownertrust.cpp: Likewise.
* lang/qt/tests/t-wkspublish.cpp: Likewise.
--
Increase the timeout when waiting for signals from 5 seconds to 60.
This addresses intermittent test failures on slow machines.

Signed-off-by: Justus Winter <justus@g10code.com>
lang/qt/tests/t-encrypt.cpp
lang/qt/tests/t-keylist.cpp
lang/qt/tests/t-keylocate.cpp
lang/qt/tests/t-ownertrust.cpp
lang/qt/tests/t-support.h
lang/qt/tests/t-wkspublish.cpp

index 57b586d..ba4a1c5 100644 (file)
@@ -165,7 +165,7 @@ private Q_SLOTS:
 
         job->start(keys, inptr, outptr, Context::AlwaysTrust);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 
     void testSymmetricEncryptDecrypt()
index 5e88a5e..a140236 100644 (file)
@@ -102,7 +102,7 @@ private Q_SLOTS:
         });
         job->start(QStringList() << "alfa@example.net");
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 };
 
index 550305c..8c99c8b 100644 (file)
@@ -88,7 +88,7 @@ private Q_SLOTS:
         });
         job->start(QStringList() << mTestpattern);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
         qputenv("GNUPGHOME", oldHome.toUtf8());
     }
 #endif
@@ -122,7 +122,7 @@ private Q_SLOTS:
         });
         job->start(QStringList() << mTestpattern);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 
 private:
index f2fa3c8..e9a4378 100644 (file)
@@ -78,7 +78,7 @@ private Q_SLOTS:
         });
         job2->start(key, Key::Ultimate);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
 
         job = openpgp()->keyListJob(false, true, true);
         result = job->exec(QStringList() << QStringLiteral("alfa@example.net"),
@@ -94,7 +94,7 @@ private Q_SLOTS:
             Q_EMIT asyncDone();
         });
         job3->start(key, Key::Unknown);
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
 
         job = openpgp()->keyListJob(false, true, true);
         result = job->exec(QStringList() << QStringLiteral("alfa@example.net"),
index e3f0e78..b03b05d 100644 (file)
@@ -64,4 +64,8 @@ public Q_SLOTS:
     void cleanupTestCase();
 };
 
+/* Timeout, in milliseconds, for use with QSignalSpy to wait on
+   signals.  */
+#define QSIGNALSPY_TIMEOUT     60000
+
 #endif // T_SUPPORT_H
index 64f101e..c51e8f9 100644 (file)
@@ -132,7 +132,7 @@ private Q_SLOTS:
         });
         job->startCheck ("testuser1@localhost");
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 #ifdef DO_ONLINE_TESTS
 private Q_SLOTS:
@@ -155,7 +155,7 @@ private:
         });
         job->startCheck ("testuser1@test.gnupg.org");
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 
     void testWKSPublishErrors() {
@@ -172,7 +172,7 @@ private:
         job->startCreate("AB874F24E98EBB8487EE7B170F8E3D97FE7011B7",
                          QStringLiteral("Foo@bar.baz"));
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 
     void testWKSPublishCreate() {
@@ -206,7 +206,7 @@ private:
         });
         keygenjob->start(args);
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
 
         /* Then try to create a request. */
         auto job = openpgp()->wksPublishJob();
@@ -223,7 +223,7 @@ private:
                      QStringLiteral("From: " TEST_ADDRESS)));
         });
         job->startCreate(fpr.constData(), QLatin1String(TEST_ADDRESS));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 
     void testWKSPublishReceive() {
@@ -242,7 +242,7 @@ private:
         });
         importjob->start(QByteArray(testSecKey));
         QSignalSpy spy (this, SIGNAL(asyncDone()));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
 
         /* Get a response. */
         auto job = openpgp()->wksPublishJob();
@@ -259,7 +259,7 @@ private:
                      QStringLiteral("From: " TEST_ADDRESS)));
         });
         job->startReceive(QByteArray(testResponse));
-        QVERIFY(spy.wait());
+        QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
     }
 
     void initTestCase()