Changeset View
Changeset View
Standalone View
Standalone View
plugins/cmake/testing/ctestfindjob.cpp
Show All 40 Lines | |||||
41 | void CTestFindJob::start() | 41 | void CTestFindJob::start() | ||
42 | { | 42 | { | ||
43 | qCDebug(CMAKE); | 43 | qCDebug(CMAKE); | ||
44 | QMetaObject::invokeMethod(this, "findTestCases", Qt::QueuedConnection); | 44 | QMetaObject::invokeMethod(this, "findTestCases", Qt::QueuedConnection); | ||
45 | } | 45 | } | ||
46 | 46 | | |||
47 | void CTestFindJob::findTestCases() | 47 | void CTestFindJob::findTestCases() | ||
48 | { | 48 | { | ||
49 | qCDebug(CMAKE); | | |||
50 | | ||||
51 | if (!m_suite->arguments().isEmpty()) | 49 | if (!m_suite->arguments().isEmpty()) | ||
52 | { | 50 | { | ||
53 | KDevelop::ICore::self()->testController()->addTestSuite(m_suite); | 51 | KDevelop::ICore::self()->testController()->addTestSuite(m_suite); | ||
54 | emitResult(); | 52 | emitResult(); | ||
55 | return; | 53 | return; | ||
56 | } | 54 | } | ||
57 | 55 | | |||
58 | m_pendingFiles = m_suite->sourceFiles(); | 56 | m_pendingFiles.clear(); | ||
57 | for (const auto& file : m_suite->sourceFiles()) | ||||
58 | { | ||||
59 | if (!file.isEmpty()) | ||||
60 | { | ||||
61 | m_pendingFiles << file; | ||||
62 | } | ||||
63 | } | ||||
59 | qCDebug(CMAKE) << "Source files to update:" << m_pendingFiles; | 64 | qCDebug(CMAKE) << "Source files to update:" << m_pendingFiles; | ||
60 | 65 | | |||
61 | if (m_pendingFiles.isEmpty()) | 66 | if (m_pendingFiles.isEmpty()) | ||
62 | { | 67 | { | ||
63 | KDevelop::ICore::self()->testController()->addTestSuite(m_suite); | 68 | KDevelop::ICore::self()->testController()->addTestSuite(m_suite); | ||
64 | emitResult(); | 69 | emitResult(); | ||
65 | return; | 70 | return; | ||
66 | } | 71 | } | ||
67 | 72 | | |||
68 | foreach (const KDevelop::Path &file, m_pendingFiles) | 73 | foreach (const KDevelop::Path &file, m_pendingFiles) | ||
69 | { | 74 | { | ||
70 | KDevelop::DUChain::self()->updateContextForUrl(KDevelop::IndexedString(file.toUrl()), KDevelop::TopDUContext::AllDeclarationsAndContexts, this); | 75 | KDevelop::DUChain::self()->updateContextForUrl(KDevelop::IndexedString(file.toUrl()), KDevelop::TopDUContext::AllDeclarationsAndContexts, this); | ||
71 | } | 76 | } | ||
72 | } | 77 | } | ||
73 | 78 | | |||
74 | void CTestFindJob::updateReady(const KDevelop::IndexedString& document, const KDevelop::ReferencedTopDUContext& context) | 79 | void CTestFindJob::updateReady(const KDevelop::IndexedString& document, const KDevelop::ReferencedTopDUContext& context) | ||
75 | { | 80 | { | ||
76 | qCDebug(CMAKE) << m_pendingFiles << document.str(); | 81 | qCDebug(CMAKE) << "context update ready" << m_pendingFiles << document.str(); | ||
77 | m_suite->loadDeclarations(document, context); | 82 | m_suite->loadDeclarations(document, context); | ||
78 | m_pendingFiles.removeAll(KDevelop::Path(document.toUrl())); | 83 | m_pendingFiles.removeAll(KDevelop::Path(document.toUrl())); | ||
79 | 84 | | |||
80 | if (m_pendingFiles.isEmpty()) | 85 | if (m_pendingFiles.isEmpty()) | ||
81 | { | 86 | { | ||
82 | KDevelop::ICore::self()->testController()->addTestSuite(m_suite); | 87 | KDevelop::ICore::self()->testController()->addTestSuite(m_suite); | ||
83 | emitResult(); | 88 | emitResult(); | ||
84 | } | 89 | } | ||
85 | } | 90 | } | ||
86 | 91 | | |||
87 | bool CTestFindJob::doKill() | 92 | bool CTestFindJob::doKill() | ||
88 | { | 93 | { | ||
89 | KDevelop::ICore::self()->languageController()->backgroundParser()->revertAllRequests(this); | 94 | KDevelop::ICore::self()->languageController()->backgroundParser()->revertAllRequests(this); | ||
90 | return true; | 95 | return true; | ||
91 | } | 96 | } |