AutoTest: Fix warning for guessed configs

The check whether to emit a warning regarding guessed
configurations must get evaluated after the configuration
has been completed otherwise the guessed flag would be
always false.

Change-Id: I20e6dcdfff5110d4d9128ffcc97cba1a70f44fe9
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2017-03-14 09:16:01 +01:00
parent 124efb32f5
commit 0a3efc042d

View File

@@ -100,12 +100,19 @@ static void performTestRun(QFutureInterface<TestResultPtr> &futureInterface,
const TestSettings &settings)
{
const int timeout = settings.timeout;
const bool omitRunConfigWarnings = settings.omitRunConfigWarn;
QEventLoop eventLoop;
int testCaseCount = 0;
for (TestConfiguration *config : selectedTests) {
config->completeTestInformation(TestRunner::Run);
if (config->project()) {
testCaseCount += config->testCaseCount();
if (!omitRunConfigWarnings && config->guessedConfiguration()) {
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
TestRunner::tr("Project's run configuration was guessed for \"%1\".\n"
"This might cause trouble during execution."
).arg(config->displayName()))));
}
} else {
futureInterface.reportResult(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
TestRunner::tr("Project is null for \"%1\". Removing from test run.\n"
@@ -196,22 +203,12 @@ void TestRunner::prepareToRunTests(Mode mode)
return;
}
const bool omitRunConfigWarnings = AutotestPlugin::instance()->settings()->omitRunConfigWarn;
m_executingTests = true;
emit testRunStarted();
// clear old log and output pane
TestResultsPane::instance()->clearContents();
for (TestConfiguration *config : m_selectedTests) {
if (!omitRunConfigWarnings && config->guessedConfiguration()) {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
tr("Project's run configuration was guessed for \"%1\".\n"
"This might cause trouble during execution.").arg(config->displayName()))));
}
}
if (m_selectedTests.empty()) {
emit testResultReady(TestResultPtr(new FaultyTestResult(Result::MessageWarn,
tr("No tests selected. Canceling test run."))));