From d226c84cca3d20cd6ed7ca0a8b9a899c91bd728b Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 15 Jan 2018 10:38:27 +0100 Subject: [PATCH] AutoTest: Omit tests that cannot get handled We might find some test constructs that cannot get run without further knowledge which should be provided by the user (e.g. plugin unit tests of QC) Omit these tests to avoid user irritation and useless warnings. Change-Id: Ia8f533b931a7c58bd768697c0915cbdd44225534 Reviewed-by: David Schulz --- src/plugins/autotest/qtest/qttestparser.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/plugins/autotest/qtest/qttestparser.cpp b/src/plugins/autotest/qtest/qttestparser.cpp index 482e14f60b2..6facee38a9e 100644 --- a/src/plugins/autotest/qtest/qttestparser.cpp +++ b/src/plugins/autotest/qtest/qttestparser.cpp @@ -271,6 +271,13 @@ static QtTestCodeLocationList tagLocationsFor(const QtTestParseResult *func, return QtTestCodeLocationList(); } +static bool isQObject(const CPlusPlus::Document::Ptr &declaringDoc) +{ + const QString file = declaringDoc->fileName(); + return (Utils::HostOsInfo::isMacHost() && file.endsWith("QtCore.framework/Headers/qobject.h")) + || file.endsWith("QtCore/qobject.h") || file.endsWith("kernel/qobject.h"); +} + static bool handleQtTest(QFutureInterface futureInterface, CPlusPlus::Document::Ptr document, const CPlusPlus::Snapshot &snapshot, @@ -303,6 +310,10 @@ static bool handleQtTest(QFutureInterface futureInterface, fetchAndMergeBaseTestFunctions( visitor.baseClasses(), testFunctions, declaringDoc, snapshot); + // handle tests that are not runnable without more information (plugin unit test of QC) + if (testFunctions.isEmpty() && testCaseName == "QObject" && isQObject(declaringDoc)) + return true; // we did not handle it, but we do not expect any test defined there either + const QSet &files = filesWithDataFunctionDefinitions(testFunctions); // TODO: change to QHash<>