forked from qt-creator/qt-creator
AutoTest: Speed up scanning for tests
Especially Qt and Quick tests scanning takes some time, so do some additional pre-filtering of files before parsing them to reduce the number of files to process. Depending on the structure of the project this can significantly reduce the scan time. Task-number: QTCREATORBUG-29301 Change-Id: I629beedcc02502d98d84e29282e1cd7b265cfcf0 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
@@ -295,6 +295,9 @@ static bool isQObject(const CPlusPlus::Document::Ptr &declaringDoc)
|
||||
bool QtTestParser::processDocument(QPromise<TestParseResultPtr> &promise,
|
||||
const FilePath &fileName)
|
||||
{
|
||||
if (!m_prefilteredFiles.contains(fileName))
|
||||
return false;
|
||||
|
||||
CPlusPlus::Document::Ptr doc = document(fileName);
|
||||
if (doc.isNull())
|
||||
return false;
|
||||
@@ -418,6 +421,12 @@ void QtTestParser::init(const QSet<FilePath> &filesToParse, bool fullParse)
|
||||
m_testCases = QTestUtils::testCaseNamesForFiles(framework(), filesToParse);
|
||||
m_alternativeFiles = QTestUtils::alternativeFiles(framework(), filesToParse);
|
||||
}
|
||||
|
||||
if (std::optional<QSet<Utils::FilePath>> prefiltered = filesContainingMacro("QT_TESTLIB_LIB"))
|
||||
m_prefilteredFiles = prefiltered->intersect(filesToParse);
|
||||
else
|
||||
m_prefilteredFiles = filesToParse;
|
||||
|
||||
CppParser::init(filesToParse, fullParse);
|
||||
}
|
||||
|
||||
@@ -425,6 +434,7 @@ void QtTestParser::release()
|
||||
{
|
||||
m_testCases.clear();
|
||||
m_alternativeFiles.clear();
|
||||
m_prefilteredFiles.clear();
|
||||
CppParser::release();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user