MCPcopy Create free account
hub / github.com/KDE/kdevelop / testIncludeLocking

Method testIncludeLocking

plugins/clang/tests/test_duchain.cpp:418–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418void TestDUChain::testIncludeLocking()
419{
420 TestFile header1(createCode("Header1", 1000), QStringLiteral("h"));
421 TestFile header2(createCode("Header2", 1000), QStringLiteral("h"));
422 TestFile header3(createCode("Header3", 1000), QStringLiteral("h"));
423
424 ICore::self()->languageController()->backgroundParser()->setThreadCount(3);
425
426 TestFile impl1("#include \"" + header1.url().str() + "\"\n"
427 "#include \"" + header2.url().str() + "\"\n"
428 "#include \"" + header3.url().str() + "\"\n"
429 "int main() { return 0; }", QStringLiteral("cpp"));
430
431 TestFile impl2("#include \"" + header2.url().str() + "\"\n"
432 "#include \"" + header1.url().str() + "\"\n"
433 "#include \"" + header3.url().str() + "\"\n"
434 "int main() { return 0; }", QStringLiteral("cpp"));
435
436 TestFile impl3("#include \"" + header3.url().str() + "\"\n"
437 "#include \"" + header1.url().str() + "\"\n"
438 "#include \"" + header2.url().str() + "\"\n"
439 "int main() { return 0; }", QStringLiteral("cpp"));
440
441 impl1.parse(TopDUContext::AllDeclarationsContextsAndUses);
442 impl2.parse(TopDUContext::AllDeclarationsContextsAndUses);
443 impl3.parse(TopDUContext::AllDeclarationsContextsAndUses);
444
445 QVERIFY(impl1.waitForParsed(5000));
446 QVERIFY(impl2.waitForParsed(5000));
447 QVERIFY(impl3.waitForParsed(5000));
448
449 DUChainReadLocker lock;
450 QVERIFY(DUChain::self()->chainForDocument(header1.url()));
451 QVERIFY(DUChain::self()->chainForDocument(header2.url()));
452 QVERIFY(DUChain::self()->chainForDocument(header3.url()));
453}
454
455void TestDUChain::testReparse()
456{

Callers

nothing calls this directly

Calls 9

createCodeFunction · 0.85
setThreadCountMethod · 0.80
backgroundParserMethod · 0.80
languageControllerMethod · 0.80
strMethod · 0.80
waitForParsedMethod · 0.80
chainForDocumentMethod · 0.80
urlMethod · 0.45
parseMethod · 0.45

Tested by

no test coverage detected