diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/autotest/testconfiguration.cpp | 8 | ||||
-rw-r--r-- | plugins/autotest/testconfiguration.h | 4 | ||||
-rw-r--r-- | plugins/autotest/testrunner.cpp | 17 | ||||
-rw-r--r-- | plugins/autotest/testsettings.cpp | 8 | ||||
-rw-r--r-- | plugins/autotest/testsettings.h | 1 | ||||
-rw-r--r-- | plugins/autotest/testsettingspage.cpp | 2 | ||||
-rw-r--r-- | plugins/autotest/testsettingspage.ui | 466 | ||||
-rw-r--r-- | plugins/autotest/testtreemodel.cpp | 33 |
8 files changed, 309 insertions, 230 deletions
diff --git a/plugins/autotest/testconfiguration.cpp b/plugins/autotest/testconfiguration.cpp index 9589d68c02..a8ca374334 100644 --- a/plugins/autotest/testconfiguration.cpp +++ b/plugins/autotest/testconfiguration.cpp @@ -30,7 +30,8 @@ TestConfiguration::TestConfiguration(const QString &testClass, const QStringList m_testCases(testCases), m_testCaseCount(testCaseCount), m_unnamedOnly(false), - m_project(0) + m_project(0), + m_guessedConfiguration(false) { if (testCases.size() != 0) { m_testCaseCount = testCases.size(); @@ -102,5 +103,10 @@ void TestConfiguration::setUnnamedOnly(bool unnamedOnly) m_unnamedOnly = unnamedOnly; } +void TestConfiguration::setGuessedConfiguration(bool guessed) +{ + m_guessedConfiguration = guessed; +} + } // namespace Internal } // namespace Autotest diff --git a/plugins/autotest/testconfiguration.h b/plugins/autotest/testconfiguration.h index 8d9235b512..82fb874ca4 100644 --- a/plugins/autotest/testconfiguration.h +++ b/plugins/autotest/testconfiguration.h @@ -50,6 +50,7 @@ public: void setEnvironment(const Utils::Environment &env); void setProject(ProjectExplorer::Project *project); void setUnnamedOnly(bool unnamedOnly); + void setGuessedConfiguration(bool guessed); QString testClass() const { return m_testClass; } QStringList testCases() const { return m_testCases; } @@ -62,7 +63,7 @@ public: Utils::Environment environment() const { return m_environment; } ProjectExplorer::Project *project() const { return m_project; } bool unnamedOnly() const { return m_unnamedOnly; } - + bool guessedConfiguration() const { return m_guessedConfiguration; } signals: @@ -80,6 +81,7 @@ private: QString m_displayName; Utils::Environment m_environment; ProjectExplorer::Project *m_project; + bool m_guessedConfiguration; }; } // namespace Internal diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp index 185803fb02..150e72750d 100644 --- a/plugins/autotest/testrunner.cpp +++ b/plugins/autotest/testrunner.cpp @@ -185,12 +185,17 @@ void performTestRun(QFutureInterface<void> &futureInterface, void TestRunner::runTests() { + const QSharedPointer<TestSettings> settings = AutotestPlugin::instance()->settings(); + const int timeout = settings->timeout; + const QString metricsOption = TestSettings::metricsTypeToOption(settings->metrics); + const bool displayRunConfigWarnings = !settings->omitRunConfigWarn; + // clear old log and output pane TestResultsPane::instance()->clearContents(); // handle faulty test configurations QList<TestConfiguration *> toBeRemoved; - foreach (TestConfiguration *config, m_selectedTests) + foreach (TestConfiguration *config, m_selectedTests) { if (!config->project()) { toBeRemoved.append(config); TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, @@ -198,6 +203,12 @@ void TestRunner::runTests() "This might be the case for a faulty environment or similar." ).arg(config->displayName()))); } + if (displayRunConfigWarnings && 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()))); + } + } foreach (TestConfiguration *config, toBeRemoved) { m_selectedTests.removeOne(config); delete config; @@ -243,10 +254,6 @@ void TestRunner::runTests() TestResultsPane::instance(), &TestResultsPane::addTestResult, Qt::QueuedConnection); - const QSharedPointer<TestSettings> settings = AutotestPlugin::instance()->settings(); - const int timeout = settings->timeout; - const QString metricsOption = TestSettings::metricsTypeToOption(settings->metrics); - emit testRunStarted(); QFuture<void> future = QtConcurrent::run(&performTestRun, m_selectedTests, timeout, metricsOption, this); diff --git a/plugins/autotest/testsettings.cpp b/plugins/autotest/testsettings.cpp index 17a9f7c7aa..ce4c00d08d 100644 --- a/plugins/autotest/testsettings.cpp +++ b/plugins/autotest/testsettings.cpp @@ -27,10 +27,11 @@ static const char group[] = "Autotest"; static const char timeoutKey[] = "Timeout"; static const char metricsKey[] = "Metrics"; static const char omitInternalKey[] = "OmitInternal"; +static const char omitRunConfigWarnKey[] = "OmitRCWarnings"; static const int defaultTimeout = 60000; TestSettings::TestSettings() - : timeout(defaultTimeout), metrics(Walltime), omitInternalMssg(true) + : timeout(defaultTimeout), metrics(Walltime), omitInternalMssg(true), omitRunConfigWarn(false) { } @@ -40,6 +41,7 @@ void TestSettings::toSettings(QSettings *s) const s->setValue(QLatin1String(timeoutKey), timeout); s->setValue(QLatin1String(metricsKey), metrics); s->setValue(QLatin1String(omitInternalKey), omitInternalMssg); + s->setValue(QLatin1String(omitRunConfigWarnKey), omitRunConfigWarn); s->endGroup(); } @@ -67,12 +69,14 @@ void TestSettings::fromSettings(const QSettings *s) timeout = s->value(root + QLatin1String(timeoutKey), defaultTimeout).toInt(); metrics = intToMetrics(s->value(root + QLatin1String(metricsKey), Walltime).toInt()); omitInternalMssg = s->value(root + QLatin1String(omitInternalKey), true).toBool(); + omitRunConfigWarn = s->value(root + QLatin1String(omitRunConfigWarnKey), false).toBool(); } bool TestSettings::equals(const TestSettings &rhs) const { return timeout == rhs.timeout && metrics == rhs.metrics - && omitInternalMssg == rhs.omitInternalMssg; + && omitInternalMssg == rhs.omitInternalMssg + && omitRunConfigWarn == rhs.omitRunConfigWarn; } QString TestSettings::metricsTypeToOption(const MetricsType type) diff --git a/plugins/autotest/testsettings.h b/plugins/autotest/testsettings.h index dc82647d10..44ab410093 100644 --- a/plugins/autotest/testsettings.h +++ b/plugins/autotest/testsettings.h @@ -47,6 +47,7 @@ struct TestSettings int timeout; MetricsType metrics; bool omitInternalMssg; + bool omitRunConfigWarn; }; inline bool operator==(const TestSettings &s1, const TestSettings &s2) { return s1.equals(s2); } diff --git a/plugins/autotest/testsettingspage.cpp b/plugins/autotest/testsettingspage.cpp index 64be40bb9b..a41c287823 100644 --- a/plugins/autotest/testsettingspage.cpp +++ b/plugins/autotest/testsettingspage.cpp @@ -39,6 +39,7 @@ void TestSettingsWidget::setSettings(const TestSettings &settings) { m_ui.timeoutSpin->setValue(settings.timeout / 1000); // we store milliseconds m_ui.omitInternalMsgCB->setChecked(settings.omitInternalMssg); + m_ui.omitRunConfigWarnCB->setChecked(settings.omitRunConfigWarn); switch (settings.metrics) { case MetricsType::Walltime: @@ -66,6 +67,7 @@ TestSettings TestSettingsWidget::settings() const TestSettings result; result.timeout = m_ui.timeoutSpin->value() * 1000; // we display seconds result.omitInternalMssg = m_ui.omitInternalMsgCB->isChecked(); + result.omitRunConfigWarn = m_ui.omitRunConfigWarnCB->isChecked(); if (m_ui.walltimeRB->isChecked()) result.metrics = MetricsType::Walltime; diff --git a/plugins/autotest/testsettingspage.ui b/plugins/autotest/testsettingspage.ui index 1a68db4b21..164f9f7f5c 100644 --- a/plugins/autotest/testsettingspage.ui +++ b/plugins/autotest/testsettingspage.ui @@ -6,252 +6,276 @@ <rect> <x>0</x> <y>0</y> - <width>462</width> - <height>292</height> + <width>463</width> + <height>338</height> </rect> </property> <property name="windowTitle"> <string>Form</string> </property> - <layout class="QVBoxLayout" name="verticalLayout_3"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3"> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2"> - <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <widget class="QLabel" name="label"> - <property name="toolTip"> - <string>Timeout used when executing test cases. This will apply for each test case on its own, not the whole project.</string> - </property> - <property name="text"> - <string>Timeout:</string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="timeoutSpin"> - <property name="toolTip"> - <string>Timeout used when executing test cases. This will apply for each test case on its own, not the whole project.</string> - </property> - <property name="suffix"> - <string> s</string> - </property> - <property name="minimum"> - <number>5</number> - </property> - <property name="maximum"> - <number>36000</number> - </property> - <property name="value"> - <number>60</number> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QCheckBox" name="omitInternalMsgCB"> - <property name="toolTip"> - <string>If checked Internal Messages won't be shown by default. (You can still enable them on the test results filter)</string> - </property> - <property name="text"> - <string>Omit Internal Messages</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_4"> - <item> - <widget class="QGroupBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title"> - <string>Benchmark Metrics</string> - </property> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <widget class="QWidget" name=""> + <property name="geometry"> + <rect> + <x>9</x> + <y>10</y> + <width>435</width> + <height>307</height> + </rect> + </property> + <layout class="QVBoxLayout" name="verticalLayout_4"> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_3"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2"> <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QRadioButton" name="walltimeRB"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Use Walltime metrics for executing benchmarks. (default)</string> - </property> - <property name="text"> - <string>Walltime</string> - </property> - <property name="checked"> - <bool>true</bool> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="tickcounterRB"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="toolTip"> - <string>Use tick counter for executing benchmarks.</string> - </property> - <property name="text"> - <string>Tickcounter</string> - </property> - </widget> - </item> + <layout class="QHBoxLayout" name="horizontalLayout"> <item> - <widget class="QRadioButton" name="eventCounterRB"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <widget class="QLabel" name="label"> <property name="toolTip"> - <string>Use event counter when executing benchmarks.</string> + <string>Timeout used when executing test cases. This will apply for each test case on its own, not the whole project.</string> </property> <property name="text"> - <string>Eventcounter</string> + <string>Timeout:</string> </property> </widget> </item> <item> - <widget class="QRadioButton" name="callgrindRB"> - <property name="enabled"> - <bool>false</bool> - </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> + <widget class="QSpinBox" name="timeoutSpin"> <property name="toolTip"> - <string>Use callgrind when executing benchmark. (valgrind must be installed)</string> + <string>Timeout used when executing test cases. This will apply for each test case on its own, not the whole project.</string> </property> - <property name="text"> - <string>Callgrind</string> - </property> - </widget> - </item> - <item> - <widget class="QRadioButton" name="perfRB"> - <property name="enabled"> - <bool>false</bool> + <property name="suffix"> + <string> s</string> </property> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <property name="minimum"> + <number>5</number> </property> - <property name="toolTip"> - <string>Use perf when executing benchmarks. (perf must be installed)</string> + <property name="maximum"> + <number>36000</number> </property> - <property name="text"> - <string>Perf</string> + <property name="value"> + <number>60</number> </property> </widget> </item> </layout> </item> </layout> - </widget> - </item> - <item> - <spacer name="horizontalSpacer_2"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - <item> - <spacer name="verticalSpacer_2"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> + </item> + <item> + <spacer name="horizontalSpacer_3"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QCheckBox" name="omitInternalMsgCB"> + <property name="toolTip"> + <string>If checked Internal Messages won't be shown by default. (You can still enable them on the test results filter)</string> + </property> + <property name="text"> + <string>Omit Internal Messages</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="omitRunConfigWarnCB"> + <property name="toolTip"> + <string>If checked Warnings regarding a guessed Run Configuration won't be shown.</string> + </property> + <property name="text"> + <string>Omit Run Configuration Warnings</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeType"> + <enum>QSizePolicy::Fixed</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Preferred" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="title"> + <string>Benchmark Metrics</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QRadioButton" name="walltimeRB"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Use Walltime metrics for executing benchmarks. (default)</string> + </property> + <property name="text"> + <string>Walltime</string> + </property> + <property name="checked"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="tickcounterRB"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Use tick counter for executing benchmarks.</string> + </property> + <property name="text"> + <string>Tickcounter</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="eventCounterRB"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Use event counter when executing benchmarks.</string> + </property> + <property name="text"> + <string>Eventcounter</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="callgrindRB"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Use callgrind when executing benchmark. (valgrind must be installed)</string> + </property> + <property name="text"> + <string>Callgrind</string> + </property> + </widget> + </item> + <item> + <widget class="QRadioButton" name="perfRB"> + <property name="enabled"> + <bool>false</bool> + </property> + <property name="sizePolicy"> + <sizepolicy hsizetype="Minimum" vsizetype="Minimum"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="toolTip"> + <string>Use perf when executing benchmarks. (perf must be installed)</string> + </property> + <property name="text"> + <string>Perf</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <spacer name="horizontalSpacer_2"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </widget> </widget> <resources/> <connections/> diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 66abadd96a..ea2832451d 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -27,6 +27,7 @@ #include <projectexplorer/environmentaspect.h> #include <projectexplorer/localapplicationrunconfiguration.h> #include <projectexplorer/project.h> +#include <projectexplorer/projectnodes.h> #include <projectexplorer/runconfiguration.h> #include <projectexplorer/session.h> #include <projectexplorer/target.h> @@ -385,8 +386,10 @@ static void addProjectInformation(TestConfiguration *config, const QString &file QString workDir; QString proFile; QString displayName; + ProjectExplorer::Project *targetProject = 0; Utils::Environment env; bool hasDesktopTarget = false; + bool guessedRunConfiguration = false; CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance(); QList<CppTools::ProjectPart::Ptr> projParts = cppMM->projectInfo(project).projectParts(); @@ -396,6 +399,7 @@ static void addProjectInformation(TestConfiguration *config, const QString &file if (currentFile.path == filePath) { proFile = part->projectFile; displayName = part->displayName; + targetProject = part->project; break; } } @@ -429,6 +433,34 @@ static void addProjectInformation(TestConfiguration *config, const QString &file break; } } + + // if we could not figure out the run configuration + // try to use the run configuration of the parent project + if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) { + QList<ProjectExplorer::RunConfiguration *> rcs = target->runConfigurations(); + foreach (ProjectExplorer::RunConfiguration *rc, rcs) { + ProjectExplorer::LocalApplicationRunConfiguration *localRunConfiguration + = qobject_cast<ProjectExplorer::LocalApplicationRunConfiguration *>(rc); + if (localRunConfiguration) { + if (ProjectExplorer::ProjectNode *localRootProjectNode = targetProject->rootProjectNode()) { + QList<ProjectExplorer::FileNode *> localFileNodes = localRootProjectNode->fileNodes(); + if (localFileNodes.size()) { + if (localFileNodes.at(0)->path() + == targetProject->projectFilePath()) { + hasDesktopTarget = true; + workDir = Utils::FileUtils::normalizePathName( + localRunConfiguration->workingDirectory()); + ProjectExplorer::EnvironmentAspect *environmentAspect + = localRunConfiguration->extraAspect<ProjectExplorer::EnvironmentAspect>(); + env = environmentAspect->environment(); + guessedRunConfiguration = true; + break; + } + } + } + } + } + } } } @@ -440,6 +472,7 @@ static void addProjectInformation(TestConfiguration *config, const QString &file config->setEnvironment(env); config->setProject(project); config->setDisplayName(displayName); + config->setGuessedConfiguration(guessedRunConfiguration); } else { config->setProFile(proFile); config->setDisplayName(displayName); |