diff options
author | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-08-04 13:13:59 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@theqtcompany.com> | 2015-08-04 13:14:15 +0200 |
commit | c0f76a26581ff7b126e65f305dfa70471bd3db19 (patch) | |
tree | 8a44bcbc8a61fe52e1eecf9864ed62aef5c63036 | |
parent | 9e8df7d2b3e84b5fd51f3a873733cc0232c0840d (diff) | |
parent | 1108556f1ed423913d927eb501ce6a91d833e169 (diff) | |
download | qt-creator-c0f76a26581ff7b126e65f305dfa70471bd3db19.tar.gz |
Merge remote-tracking branch 'origin/3.5'
Change-Id: I8dffae0c2c62f6a6a3bfa5642c079fc9bad1412d
15 files changed, 49 insertions, 45 deletions
diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp index 525f21ae3e..9c32e0b75c 100644 --- a/plugins/autotest/autotestplugin.cpp +++ b/plugins/autotest/autotestplugin.cpp @@ -168,7 +168,7 @@ void AutotestPlugin::onRunAllTriggered() TestRunner *runner = TestRunner::instance(); TestTreeModel *model = TestTreeModel::instance(); runner->setSelectedTests(model->getAllTestCases()); - runner->runTests(); + runner->prepareToRunTests(); } void AutotestPlugin::onRunSelectedTriggered() @@ -176,7 +176,7 @@ void AutotestPlugin::onRunSelectedTriggered() TestRunner *runner = TestRunner::instance(); TestTreeModel *model = TestTreeModel::instance(); runner->setSelectedTests(model->getSelectedTests()); - runner->runTests(); + runner->prepareToRunTests(); } void AutotestPlugin::updateMenuItemsEnabledState() diff --git a/plugins/autotest/testnavigationwidget.cpp b/plugins/autotest/testnavigationwidget.cpp index da0de8a761..9745e1a19b 100644 --- a/plugins/autotest/testnavigationwidget.cpp +++ b/plugins/autotest/testnavigationwidget.cpp @@ -249,7 +249,7 @@ void TestNavigationWidget::onRunThisTestTriggered() if (TestConfiguration *configuration = m_model->getTestConfiguration(item)) { TestRunner *runner = TestRunner::instance(); runner->setSelectedTests( {configuration} ); - runner->runTests(); + runner->prepareToRunTests(); } } } diff --git a/plugins/autotest/testresultspane.cpp b/plugins/autotest/testresultspane.cpp index 9ebb1c09fb..db78e24cd6 100644 --- a/plugins/autotest/testresultspane.cpp +++ b/plugins/autotest/testresultspane.cpp @@ -288,14 +288,14 @@ void TestResultsPane::onRunAllTriggered() { TestRunner *runner = TestRunner::instance(); runner->setSelectedTests(TestTreeModel::instance()->getAllTestCases()); - runner->runTests(); + runner->prepareToRunTests(); } void TestResultsPane::onRunSelectedTriggered() { TestRunner *runner = TestRunner::instance(); runner->setSelectedTests(TestTreeModel::instance()->getSelectedTests()); - runner->runTests(); + runner->prepareToRunTests(); } void TestResultsPane::initializeFilterMenu() diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp index bc246ed6aa..b556989d62 100644 --- a/plugins/autotest/testrunner.cpp +++ b/plugins/autotest/testrunner.cpp @@ -86,7 +86,6 @@ TestRunner *TestRunner::instance() TestRunner::TestRunner(QObject *parent) : QObject(parent), - m_building(false), m_executingTests(false) { } @@ -197,12 +196,9 @@ void performTestRun(QFutureInterface<void> &futureInterface, futureInterface.setProgressValue(testCaseCount); } -void TestRunner::runTests() +void TestRunner::prepareToRunTests() { - const QSharedPointer<TestSettings> settings = AutotestPlugin::instance()->settings(); - const int timeout = settings->timeout; - const QString metricsOption = TestSettings::metricsTypeToOption(settings->metrics); - const bool displayRunConfigWarnings = !settings->omitRunConfigWarn; + const bool omitRunConfigWarnings = AutotestPlugin::instance()->settings()->omitRunConfigWarn; m_executingTests = true; emit testRunStarted(); @@ -211,7 +207,7 @@ void TestRunner::runTests() TestResultsPane::instance()->clearContents(); foreach (TestConfiguration *config, m_selectedTests) { - if (displayRunConfigWarnings && config->guessedConfiguration()) { + if (!omitRunConfigWarnings && config->guessedConfiguration()) { TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, tr("Project's run configuration was guessed for \"%1\".\n" "This might cause trouble during execution.").arg(config->displayName()))); @@ -237,38 +233,31 @@ void TestRunner::runTests() ProjectExplorer::Internal::ProjectExplorerSettings projectExplorerSettings = ProjectExplorer::ProjectExplorerPlugin::projectExplorerSettings(); - if (projectExplorerSettings.buildBeforeDeploy) { - if (!project->hasActiveBuildSettings()) { + if (!projectExplorerSettings.buildBeforeDeploy) { + runTests(); + } else { + if (project->hasActiveBuildSettings()) { + buildProject(project); + } else { TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_FATAL, tr("Project is not configured. Canceling test run."))); onFinished(); return; } - - auto connection = connect(this, &TestRunner::requestStopTestRun, [&] () { - ProjectExplorer::BuildManager::instance()->cancel(); - m_building = false; - m_buildSucceeded = false; - }); - buildProject(project); - while (m_building) { - qApp->processEvents(); - } - disconnect(connection); - - if (!m_buildSucceeded) { - TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_FATAL, - tr("Build failed. Canceling test run."))); - onFinished(); - return; - } } +} + +void TestRunner::runTests() +{ + const QSharedPointer<TestSettings> settings = AutotestPlugin::instance()->settings(); + const QString &metricsOption = TestSettings::metricsTypeToOption(settings->metrics); connect(this, &TestRunner::testResultCreated, TestResultsPane::instance(), &TestResultsPane::addTestResult, Qt::QueuedConnection); - QFuture<void> future = QtConcurrent::run(&performTestRun, m_selectedTests, timeout, metricsOption, this); + QFuture<void> future = QtConcurrent::run(&performTestRun, m_selectedTests, settings->timeout, + metricsOption, this); Core::FutureProgress *progress = Core::ProgressManager::addTask(future, tr("Running Tests"), Autotest::Constants::TASK_INDEX); connect(progress, &Core::FutureProgress::finished, @@ -277,9 +266,9 @@ void TestRunner::runTests() void TestRunner::buildProject(ProjectExplorer::Project *project) { - m_building = true; - m_buildSucceeded = false; ProjectExplorer::BuildManager *buildManager = ProjectExplorer::BuildManager::instance(); + m_buildConnect = connect(this, &TestRunner::requestStopTestRun, + buildManager, &ProjectExplorer::BuildManager::cancel); connect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished, this, &TestRunner::buildFinished); ProjectExplorer::ProjectExplorerPlugin::buildProject(project); @@ -287,11 +276,18 @@ void TestRunner::buildProject(ProjectExplorer::Project *project) void TestRunner::buildFinished(bool success) { + disconnect(m_buildConnect); ProjectExplorer::BuildManager *buildManager = ProjectExplorer::BuildManager::instance(); disconnect(buildManager, &ProjectExplorer::BuildManager::buildQueueFinished, this, &TestRunner::buildFinished); - m_building = false; - m_buildSucceeded = success; + + if (success) { + runTests(); + } else { + TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_FATAL, + tr("Build failed. Canceling test run."))); + onFinished(); + } } void TestRunner::onFinished() diff --git a/plugins/autotest/testrunner.h b/plugins/autotest/testrunner.h index ddbac5e92f..92de02f67b 100644 --- a/plugins/autotest/testrunner.h +++ b/plugins/autotest/testrunner.h @@ -51,7 +51,7 @@ signals: void requestStopTestRun(); public slots: - void runTests(); + void prepareToRunTests(); private slots: void buildProject(ProjectExplorer::Project *project); @@ -59,13 +59,14 @@ private slots: void onFinished(); private: + void runTests(); explicit TestRunner(QObject *parent = 0); QList<TestConfiguration *> m_selectedTests; - bool m_building; - bool m_buildSucceeded; bool m_executingTests; + // temporarily used if building before running is necessary + QMetaObject::Connection m_buildConnect; }; } // namespace Internal diff --git a/shared/shared.pro b/shared/shared.pro index e74d4d09ac..541044da11 100644 --- a/shared/shared.pro +++ b/shared/shared.pro @@ -1,10 +1,17 @@ +isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE) +isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD) +isEmpty(IDE_SOURCE_TREE): error("Set QTC_SOURCE environment variable") +isEmpty(IDE_BUILD_TREE): error("Set QTC_BUILD environment variable") + TEMPLATE = aux -content.files = \ - autotest +STATIC_BASE = $$PWD +STATIC_DIRS = templates -content.path = $$QTC_PREFIX/share/qtcreator/templates/wizards +for(data_dir, STATIC_DIRS) { + files = $$files($$STATIC_BASE/$$data_dir/*, true) + for(file, files): !exists($$file/*): STATIC_FILES += $$file +} -OTHER_FILES += $${content.files} +include($$IDE_SOURCE_TREE/share/qtcreator/static.pri) -INSTALLS += content diff --git a/shared/autotest/auto.pro b/shared/templates/wizards/autotest/auto.pro index b39fef654c..b39fef654c 100644 --- a/shared/autotest/auto.pro +++ b/shared/templates/wizards/autotest/auto.pro diff --git a/shared/autotest/autotest_24.png b/shared/templates/wizards/autotest/autotest_24.png Binary files differindex 3f52e9bf08..3f52e9bf08 100644 --- a/shared/autotest/autotest_24.png +++ b/shared/templates/wizards/autotest/autotest_24.png diff --git a/shared/autotest/main.cpp b/shared/templates/wizards/autotest/main.cpp index 3ff500decd..3ff500decd 100644 --- a/shared/autotest/main.cpp +++ b/shared/templates/wizards/autotest/main.cpp diff --git a/shared/autotest/src.pro b/shared/templates/wizards/autotest/src.pro index 61fbe2a5bc..61fbe2a5bc 100644 --- a/shared/autotest/src.pro +++ b/shared/templates/wizards/autotest/src.pro diff --git a/shared/autotest/tests.pro b/shared/templates/wizards/autotest/tests.pro index f927700008..f927700008 100644 --- a/shared/autotest/tests.pro +++ b/shared/templates/wizards/autotest/tests.pro diff --git a/shared/autotest/tmp.pro b/shared/templates/wizards/autotest/tmp.pro index 1569bd45cb..1569bd45cb 100644 --- a/shared/autotest/tmp.pro +++ b/shared/templates/wizards/autotest/tmp.pro diff --git a/shared/autotest/tst.pro b/shared/templates/wizards/autotest/tst.pro index 8aa61b767e..8aa61b767e 100644 --- a/shared/autotest/tst.pro +++ b/shared/templates/wizards/autotest/tst.pro diff --git a/shared/autotest/tst_src.cpp b/shared/templates/wizards/autotest/tst_src.cpp index 65d49e9c18..65d49e9c18 100644 --- a/shared/autotest/tst_src.cpp +++ b/shared/templates/wizards/autotest/tst_src.cpp diff --git a/shared/autotest/wizard.xml b/shared/templates/wizards/autotest/wizard.xml index a190405d38..a190405d38 100644 --- a/shared/autotest/wizard.xml +++ b/shared/templates/wizards/autotest/wizard.xml |