forked from qt-creator/qt-creator
CMakePM: Try to improve file information for ctest
The ctest information regarding the test case itself cannot be as adequate as the information coming from the code model. Nevertheless depending on the used mechanism we might end up in places that will not be helpful when using the test tree to open files of ctest. Try to get closer to the real declaration source if we can. Change-Id: Ia9d217f0cdc6de6230d89dd342b60856cf1312b8 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -960,7 +960,16 @@ void CMakeBuildSystem::runCTest()
|
||||
const int bt = test.value("backtrace").toInt(-1);
|
||||
// we may have no real backtrace due to different registering
|
||||
if (bt != -1) {
|
||||
const QJsonObject btRef = nodes.at(bt).toObject();
|
||||
QSet<int> seen;
|
||||
std::function<QJsonObject(int)> findAncestor = [&](int index){
|
||||
const QJsonObject node = nodes.at(index).toObject();
|
||||
const int parent = node.value("parent").toInt(-1);
|
||||
if (seen.contains(parent) || parent < 0)
|
||||
return node;
|
||||
seen << parent;
|
||||
return findAncestor(parent);
|
||||
};
|
||||
const QJsonObject btRef = findAncestor(bt);
|
||||
file = btRef.value("file").toInt(-1);
|
||||
line = btRef.value("line").toInt(-1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user