Skip to content

Commit f2e1498

Browse files
[ClangCAS] Fix downstream clang include-tree tests
Fix downstream clang cas tests that uses relative path without setting working directory. rdar://115981387
1 parent 036ecb2 commit f2e1498

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

clang/unittests/CAS/IncludeTreeTest.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ using namespace dependencies;
1717
TEST(IncludeTree, IncludeTreeScan) {
1818
std::shared_ptr<ObjectStore> DB = llvm::cas::createInMemoryCAS();
1919
auto FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
20+
FS->setCurrentWorkingDirectory("/root");
2021
auto add = [&](StringRef Path, StringRef Contents) {
2122
FS->addFile(Path, 0, llvm::MemoryBuffer::getMemBuffer(Contents));
2223
};

clang/unittests/Tooling/DependencyScannerTest.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ TEST(DependencyScanner, ScanDepsWithFS) {
248248
TEST(DependencyScanner, DepScanFSWithCASProvider) {
249249
std::shared_ptr<ObjectStore> DB = llvm::cas::createInMemoryCAS();
250250
auto FS = llvm::makeIntrusiveRefCnt<llvm::vfs::InMemoryFileSystem>();
251+
FS->setCurrentWorkingDirectory("/root");
251252
StringRef Path = "a.h";
252253
StringRef Contents = "a";
253254
FS->addFile(Path, 0, llvm::MemoryBuffer::getMemBuffer(Contents));
@@ -278,6 +279,7 @@ TEST(DependencyScanner, DepScanFSWithCASProvider) {
278279
// cas::ObjectRef and will be able to provide it.
279280
DependencyScanningWorkerFilesystem DepFS(Service.getSharedCache(),
280281
new llvm::vfs::InMemoryFileSystem);
282+
DepFS.setCurrentWorkingDirectory("/root");
281283
llvm::ErrorOr<std::unique_ptr<llvm::vfs::File>> File =
282284
DepFS.openFileForRead(Path);
283285
ASSERT_TRUE(File);

0 commit comments

Comments
 (0)