From f129ed9d961559b489919445198727d4fd6a5d36 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Fri, 18 May 2018 06:55:30 +0200 Subject: AutoTest: Fix timeout handling Qt5.5 introduced a hard limit of 5 minutes for the test case run. If the timeout configured inside the settings is higher and the test case runs longer than the the internal default the test would crash ignoring the timeout set by the user. Qt5.6.1 fixed this by adding a capability to raise this limit. Handle the hard limit used inside QTest appropriate. Task-number: QTCREATORBUG-20439 Change-Id: I33f1d9bce4e503be7175228dde50b4484e57d337 Reviewed-by: David Schulz --- src/plugins/autotest/testrunner.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/autotest/testrunner.cpp b/src/plugins/autotest/testrunner.cpp index ee1a6fa985..e70870b417 100644 --- a/src/plugins/autotest/testrunner.cpp +++ b/src/plugins/autotest/testrunner.cpp @@ -195,14 +195,15 @@ void TestRunner::scheduleNext() QProcessEnvironment environment = m_currentConfig->environment().toProcessEnvironment(); if (Utils::HostOsInfo::isWindowsHost()) environment.insert("QT_LOGGING_TO_CONSOLE", "1"); + const int timeout = AutotestPlugin::settings()->timeout; + if (timeout > 5 * 60 * 1000) // Qt5.5 introduced hard limit, Qt5.6.1 added env var to raise this + environment.insert("QTEST_FUNCTION_TIMEOUT", QString::number(timeout)); m_currentProcess->setProcessEnvironment(environment); connect(m_currentProcess, static_cast(&QProcess::finished), this, &TestRunner::onProcessFinished); - QTimer::singleShot(AutotestPlugin::settings()->timeout, m_currentProcess, [this]() { - cancelCurrent(Timeout); - }); + QTimer::singleShot(timeout, m_currentProcess, [this]() { cancelCurrent(Timeout); }); m_currentProcess->start(); if (!m_currentProcess->waitForStarted()) { -- cgit v1.2.3