forked from qt-creator/qt-creator
AutoTest: Handle conflicting update triggers
If a postponed update should be done for a single parser only and another full update for all is triggered the latter one would be ignored which is wrong. An update for all parsers should always have higher priority and replace a possible scheduled update for a single parser. Change-Id: I5e1e446c7dcb9ddbcaed4606ff87a894235b723e Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -136,13 +136,16 @@ void TestCodeParser::emitUpdateTestTree(ITestParser *parser)
|
|||||||
if (m_testCodeParsers.isEmpty())
|
if (m_testCodeParsers.isEmpty())
|
||||||
return;
|
return;
|
||||||
if (m_singleShotScheduled) {
|
if (m_singleShotScheduled) {
|
||||||
|
if (m_updateParser && parser != m_updateParser)
|
||||||
|
m_updateParser = nullptr;
|
||||||
qCDebug(LOG) << "not scheduling another updateTestTree";
|
qCDebug(LOG) << "not scheduling another updateTestTree";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
qCDebug(LOG) << "adding singleShot";
|
qCDebug(LOG) << "adding singleShot";
|
||||||
m_singleShotScheduled = true;
|
m_singleShotScheduled = true;
|
||||||
QTimer::singleShot(1000, this, [this, parser](){ updateTestTree(parser); });
|
m_updateParser = parser;
|
||||||
|
QTimer::singleShot(1000, this, [this](){ updateTestTree(m_updateParser); });
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestCodeParser::updateTestTree(ITestParser *parser)
|
void TestCodeParser::updateTestTree(ITestParser *parser)
|
||||||
@@ -152,6 +155,8 @@ void TestCodeParser::updateTestTree(ITestParser *parser)
|
|||||||
m_fullUpdatePostponed = true;
|
m_fullUpdatePostponed = true;
|
||||||
m_partialUpdatePostponed = false;
|
m_partialUpdatePostponed = false;
|
||||||
m_postponedFiles.clear();
|
m_postponedFiles.clear();
|
||||||
|
if (!parser || parser != m_updateParser)
|
||||||
|
m_updateParser = nullptr;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -452,6 +457,7 @@ void TestCodeParser::onFinished()
|
|||||||
} else {
|
} else {
|
||||||
qCDebug(LOG) << "emitting parsingFinished"
|
qCDebug(LOG) << "emitting parsingFinished"
|
||||||
<< "(onFinished, FullParse, nothing postponed, parsing succeeded)";
|
<< "(onFinished, FullParse, nothing postponed, parsing succeeded)";
|
||||||
|
m_updateParser = nullptr;
|
||||||
emit parsingFinished();
|
emit parsingFinished();
|
||||||
qCDebug(LOG) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << "ParsingFin";
|
qCDebug(LOG) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << "ParsingFin";
|
||||||
}
|
}
|
||||||
@@ -474,7 +480,7 @@ void TestCodeParser::onPartialParsingFinished()
|
|||||||
if (m_fullUpdatePostponed) {
|
if (m_fullUpdatePostponed) {
|
||||||
m_fullUpdatePostponed = false;
|
m_fullUpdatePostponed = false;
|
||||||
qCDebug(LOG) << "calling updateTestTree (onPartialParsingFinished)";
|
qCDebug(LOG) << "calling updateTestTree (onPartialParsingFinished)";
|
||||||
updateTestTree();
|
updateTestTree(m_updateParser);
|
||||||
} else if (m_partialUpdatePostponed) {
|
} else if (m_partialUpdatePostponed) {
|
||||||
m_partialUpdatePostponed = false;
|
m_partialUpdatePostponed = false;
|
||||||
qCDebug(LOG) << "calling scanForTests with postponed files (onPartialParsingFinished)";
|
qCDebug(LOG) << "calling scanForTests with postponed files (onPartialParsingFinished)";
|
||||||
@@ -488,6 +494,7 @@ void TestCodeParser::onPartialParsingFinished()
|
|||||||
} else if (!m_singleShotScheduled) {
|
} else if (!m_singleShotScheduled) {
|
||||||
qCDebug(LOG) << "emitting parsingFinished"
|
qCDebug(LOG) << "emitting parsingFinished"
|
||||||
<< "(onPartialParsingFinished, nothing postponed, not dirty)";
|
<< "(onPartialParsingFinished, nothing postponed, not dirty)";
|
||||||
|
m_updateParser = nullptr;
|
||||||
emit parsingFinished();
|
emit parsingFinished();
|
||||||
qCDebug(LOG) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << "ParsingFin";
|
qCDebug(LOG) << QDateTime::currentDateTime().toString("hh:mm:ss.zzz") << "ParsingFin";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ private:
|
|||||||
QFutureWatcher<TestParseResultPtr> m_futureWatcher;
|
QFutureWatcher<TestParseResultPtr> m_futureWatcher;
|
||||||
QVector<ITestParser *> m_testCodeParsers; // ptrs are still owned by TestFrameworkManager
|
QVector<ITestParser *> m_testCodeParsers; // ptrs are still owned by TestFrameworkManager
|
||||||
QTimer m_reparseTimer;
|
QTimer m_reparseTimer;
|
||||||
|
ITestParser *m_updateParser = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user