diff options
author | Christian Stenger <christian.stenger@qt.io> | 2018-05-18 06:55:30 +0200 |
---|---|---|
committer | Christian Stenger <christian.stenger@qt.io> | 2018-05-18 12:33:44 +0000 |
commit | f129ed9d961559b489919445198727d4fd6a5d36 (patch) | |
tree | 0a86811dd92d7b5fbb5dd3be377a7076ca3b901a | |
parent | a1a78c4c69257511efbcd322b87f9c9f448b4346 (diff) |
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 <david.schulz@qt.io>
-rw-r--r-- | src/plugins/autotest/testrunner.cpp | 7 |
1 files 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<void (QProcess::*)(int, QProcess::ExitStatus)>(&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()) { |