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 <david.schulz@qt.io>
This commit is contained in:
Christian Stenger
2018-01-15 10:38:27 +01:00
parent f1d57a835f
commit d226c84cca

View File

@@ -271,6 +271,13 @@ static QtTestCodeLocationList tagLocationsFor(const QtTestParseResult *func,
return QtTestCodeLocationList(); 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<TestParseResultPtr> futureInterface, static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
CPlusPlus::Document::Ptr document, CPlusPlus::Document::Ptr document,
const CPlusPlus::Snapshot &snapshot, const CPlusPlus::Snapshot &snapshot,
@@ -303,6 +310,10 @@ static bool handleQtTest(QFutureInterface<TestParseResultPtr> futureInterface,
fetchAndMergeBaseTestFunctions( fetchAndMergeBaseTestFunctions(
visitor.baseClasses(), testFunctions, declaringDoc, snapshot); 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<QString> &files = filesWithDataFunctionDefinitions(testFunctions); const QSet<QString> &files = filesWithDataFunctionDefinitions(testFunctions);
// TODO: change to QHash<> // TODO: change to QHash<>