From 645e75e0163f87ded9f75ea15880c1f28aafe3a8 Mon Sep 17 00:00:00 2001
From: Lukas Holecek <hluk@email.cz>
Date: Wed, 16 Dec 2020 19:50:30 +0100
Subject: [PATCH] Tests: Fix test timeout

---
 src/tests/tests.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/tests/tests.cpp b/src/tests/tests.cpp
index 8e5723bf5..4f706f1e8 100644
--- a/src/tests/tests.cpp
+++ b/src/tests/tests.cpp
@@ -3939,6 +3939,14 @@ int runTests(int argc, char *argv[])
     Settings::canModifySettings = true;
     platform->loadSettings();
 
+    // Set higher default tests timeout.
+    // The default value is 5 minutes (in Qt 5.15) which is not enough to run
+    // all tests in Tests class on some systems.
+    bool ok;
+    const int timeout = qEnvironmentVariableIntValue("QTEST_FUNCTION_TIMEOUT", &ok);
+    if (!ok || timeout <= 0)
+        qputenv("QTEST_FUNCTION_TIMEOUT", QByteArray::number(15 * 60 * 1000));
+
     int exitCode = 0;
     std::shared_ptr<TestInterfaceImpl> test(new TestInterfaceImpl);
     Tests tc(test);
-- 
GitLab