Unit tests: Explicitly check for success from runner.

We will otherwise miss runner failures for any file that does not
contribute to the diagnostics count.
Note: The tool can also fail during the building stage, but in this case
we will get notified by the signal spy timing out.

Change-Id: Ia9aa797d658b1752e3da6e08a652ee55868955ba
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com>
This commit is contained in:
Christian Kandeler
2015-05-04 14:57:03 +02:00
parent 5a493ae38f
commit 59e01e2a89
5 changed files with 14 additions and 8 deletions

View File

@@ -214,6 +214,7 @@ QList<ClangStaticAnalyzerRunControl::AnalyzeUnit> ClangStaticAnalyzerRunControl:
bool ClangStaticAnalyzerRunControl::startEngine()
{
m_success = false;
emit starting(this);
QTC_ASSERT(m_projectInfo.isValid(), emit finished(); return false);
@@ -277,6 +278,7 @@ bool ClangStaticAnalyzerRunControl::startEngine()
m_runners.clear();
const int parallelRuns = ClangStaticAnalyzerSettings::instance()->simultaneousProcesses();
QTC_ASSERT(parallelRuns >= 1, emit finished(); return false);
m_success = true;
while (m_runners.size() < parallelRuns && !m_unitsToProcess.isEmpty())
analyzeNextFile();
return true;
@@ -373,6 +375,7 @@ void ClangStaticAnalyzerRunControl::onRunnerFinishedWithFailure(const QString &e
qCDebug(LOG) << "onRunnerFinishedWithFailure:" << errorMessage << errorDetails;
++m_filesNotAnalyzed;
m_success = false;
const QString filePath = qobject_cast<ClangStaticAnalyzerRunner *>(sender())->filePath();
appendMessage(tr("Failed to analyze \"%1\": %2").arg(filePath, errorMessage)
+ QLatin1Char('\n')