| 416 | } |
| 417 | |
| 418 | void 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 | |
| 455 | void TestDUChain::testReparse() |
| 456 | { |
nothing calls this directly
no test coverage detected