forked from qt-creator/qt-creator
AutoTest: Fix handling of subtyping TestCase again
We need a more present snapshot when inspecting the AST of QML files we need to process. Due to handling all problematic accesses inside the QmlJS model by guarding it with mutexes it is no problem even when parsing multi threaded. The former fix collided with another patch and therefore went in without fixing the issue. Task-number: QTCREATORBUG-17787 Change-Id: I460bae4b09cdc9a0cd38bc3383fd593c3abdfaad Reviewed-by: Marco Benelli <marco.benelli@qt.io>
This commit is contained in:
@@ -165,7 +165,6 @@ static QList<QmlJS::Document::Ptr> scanDirectoryForQuickTestQmlFiles(const QStri
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr> futureInterface,
|
static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||||
const QmlJS::Snapshot &snapshot,
|
|
||||||
const QmlJS::Document::Ptr &qmlJSDoc,
|
const QmlJS::Document::Ptr &qmlJSDoc,
|
||||||
const Core::Id &id,
|
const Core::Id &id,
|
||||||
const QString &proFile = QString())
|
const QString &proFile = QString())
|
||||||
@@ -174,6 +173,7 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr
|
|||||||
return false;
|
return false;
|
||||||
QmlJS::AST::Node *ast = qmlJSDoc->ast();
|
QmlJS::AST::Node *ast = qmlJSDoc->ast();
|
||||||
QTC_ASSERT(ast, return false);
|
QTC_ASSERT(ast, return false);
|
||||||
|
QmlJS::Snapshot snapshot = QmlJS::ModelManagerInterface::instance()->snapshot();
|
||||||
TestQmlVisitor qmlVisitor(qmlJSDoc, snapshot);
|
TestQmlVisitor qmlVisitor(qmlJSDoc, snapshot);
|
||||||
QmlJS::AST::Node::accept(ast, &qmlVisitor);
|
QmlJS::AST::Node::accept(ast, &qmlVisitor);
|
||||||
if (!qmlVisitor.isValid())
|
if (!qmlVisitor.isValid())
|
||||||
@@ -212,7 +212,6 @@ static bool checkQmlDocumentForQuickTestCode(QFutureInterface<TestParseResultPtr
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
static bool handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterface,
|
||||||
const QmlJS::Snapshot &snapshot,
|
|
||||||
CPlusPlus::Document::Ptr document,
|
CPlusPlus::Document::Ptr document,
|
||||||
const Core::Id &id)
|
const Core::Id &id)
|
||||||
{
|
{
|
||||||
@@ -233,7 +232,7 @@ static bool handleQtQuickTest(QFutureInterface<TestParseResultPtr> futureInterfa
|
|||||||
const QList<QmlJS::Document::Ptr> qmlDocs = scanDirectoryForQuickTestQmlFiles(srcDir);
|
const QList<QmlJS::Document::Ptr> qmlDocs = scanDirectoryForQuickTestQmlFiles(srcDir);
|
||||||
bool result = false;
|
bool result = false;
|
||||||
for (const QmlJS::Document::Ptr &qmlJSDoc : qmlDocs)
|
for (const QmlJS::Document::Ptr &qmlJSDoc : qmlDocs)
|
||||||
result |= checkQmlDocumentForQuickTestCode(futureInterface, snapshot, qmlJSDoc, id, proFile);
|
result |= checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id, proFile);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,14 +279,14 @@ bool QuickTestParser::processDocument(QFutureInterface<TestParseResultPtr> futur
|
|||||||
if (proFile.isEmpty())
|
if (proFile.isEmpty())
|
||||||
return false;
|
return false;
|
||||||
QmlJS::Document::Ptr qmlJSDoc = m_qmlSnapshot.document(fileName);
|
QmlJS::Document::Ptr qmlJSDoc = m_qmlSnapshot.document(fileName);
|
||||||
return checkQmlDocumentForQuickTestCode(futureInterface, m_qmlSnapshot, qmlJSDoc, id(), proFile);
|
return checkQmlDocumentForQuickTestCode(futureInterface, qmlJSDoc, id(), proFile);
|
||||||
}
|
}
|
||||||
if (!m_cppSnapshot.contains(fileName) || !selectedForBuilding(fileName))
|
if (!m_cppSnapshot.contains(fileName) || !selectedForBuilding(fileName))
|
||||||
return false;
|
return false;
|
||||||
CPlusPlus::Document::Ptr document = m_cppSnapshot.find(fileName).value();
|
CPlusPlus::Document::Ptr document = m_cppSnapshot.find(fileName).value();
|
||||||
if (!includesQtQuickTest(document, m_cppSnapshot))
|
if (!includesQtQuickTest(document, m_cppSnapshot))
|
||||||
return false;
|
return false;
|
||||||
return handleQtQuickTest(futureInterface, m_qmlSnapshot, document, id());
|
return handleQtQuickTest(futureInterface, document, id());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user