Clang: Watch only PCH sources

We watched all sources but we do not want to watch the sources of the
project part because they are not used to build a PCH.

Change-Id: I700cd6077fc54230c9be94d620043cf3f10cf9ea
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Marco Bubke
2019-06-18 18:26:27 +02:00
parent cbfd9dc16b
commit e031ada154
13 changed files with 49 additions and 37 deletions

View File

@@ -226,16 +226,21 @@ TEST_F(PchCreatorVerySlowTest, SourcesAreWatchedAfterSucess)
creator.doInMainThreadAfterFinished();
}
TEST_F(PchCreatorVerySlowTest, SourcesAreNotWatchedAfterFail)
TEST_F(PchCreatorVerySlowTest, SourcesAreWatchedAfterFail)
{
pchTask1.systemIncludeSearchPaths = {};
pchTask1.projectIncludeSearchPaths = {};
creator.generatePch(std::move(pchTask1));
EXPECT_CALL(mockClangPathWatcher,
updateIdPaths(
ElementsAre(AllOf(Field(&ClangBackEnd::IdPaths::id, 1),
Field(&ClangBackEnd::IdPaths::filePathIds, IsEmpty())))));
updateIdPaths(ElementsAre(AllOf(
Field(&ClangBackEnd::IdPaths::id, 1),
Field(&ClangBackEnd::IdPaths::filePathIds,
UnorderedElementsAre(
id(TESTDATA_DIR "/builddependencycollector/project/header2.h"),
id(TESTDATA_DIR "/builddependencycollector/external/external1.h"),
id(TESTDATA_DIR "/builddependencycollector/external/external2.h"),
id(TESTDATA_DIR "/builddependencycollector/project/main2.cpp")))))));
creator.doInMainThreadAfterFinished();
}
@@ -337,9 +342,14 @@ TEST_F(PchCreatorSlowTest, NoIncludesInTheMainThreadCalls)
Field(&ClangBackEnd::PrecompiledHeadersUpdatedMessage::projectPartIds,
ElementsAre(Eq(creator.projectPartPch().projectPartId)))));
EXPECT_CALL(mockClangPathWatcher,
updateIdPaths(
ElementsAre(AllOf(Field(&ClangBackEnd::IdPaths::id, 1),
Field(&ClangBackEnd::IdPaths::filePathIds, IsEmpty())))));
updateIdPaths(ElementsAre(AllOf(
Field(&ClangBackEnd::IdPaths::id, 1),
Field(&ClangBackEnd::IdPaths::filePathIds,
UnorderedElementsAre(
id(TESTDATA_DIR "/builddependencycollector/project/header2.h"),
id(TESTDATA_DIR "/builddependencycollector/external/external1.h"),
id(TESTDATA_DIR "/builddependencycollector/external/external2.h"),
id(TESTDATA_DIR "/builddependencycollector/project/main2.cpp")))))));
EXPECT_CALL(mockBuildDependenciesStorage, updatePchCreationTimeStamp(Gt(0), Eq(1)));
creator.doInMainThreadAfterFinished();