Skip to content

Commit

Permalink
Revert "Relands "[YAMLVFSWriter][Test][NFC] Add couple tests""
Browse files Browse the repository at this point in the history
This reverts commit 49b32d8.
  • Loading branch information
jkorous-apple committed May 9, 2020
1 parent c6ed1fc commit e4e3e41
Showing 1 changed file with 0 additions and 57 deletions.
57 changes: 0 additions & 57 deletions llvm/unittests/Support/VirtualFileSystemTest.cpp
Expand Up @@ -2274,60 +2274,3 @@ TEST_F(VFSFromYAMLTest, YAMLVFSWriterTestHandleDirs) {
EXPECT_FALSE(FS->exists(_b.Path + "/b"));
EXPECT_FALSE(FS->exists(_c.Path + "/c"));
}

TEST_F(VFSFromYAMLTest, YAMLVFSWriterTestNestedDirs) {
ScopedDir TestDirectory("virtual-file-system-test", /*Unique*/ true);
ScopedDir a(TestDirectory + "/a");
ScopedDir _a_aa(TestDirectory + "/a/aa");
ScopedDir b(TestDirectory + "/b");
ScopedDir _b_bb(TestDirectory + "/b/bb");
ScopedDir c(TestDirectory + "/c");
ScopedDir _c_cc(TestDirectory + "/c/cc");

vfs::YAMLVFSWriter VFSWriter;
VFSWriter.addDirectoryMapping(a.Path, "//root/a");
VFSWriter.addDirectoryMapping(_a_aa.Path, "//root/a/aa");
VFSWriter.addDirectoryMapping(b.Path, "//root/b");
VFSWriter.addDirectoryMapping(_b_bb.Path, "//root/b/bb");
VFSWriter.addDirectoryMapping(c.Path, "//root/c");
VFSWriter.addDirectoryMapping(_c_cc.Path, "//root/c/cc");

std::string Buffer;
raw_string_ostream OS(Buffer);
VFSWriter.write(OS);
OS.flush();

IntrusiveRefCntPtr<ErrorDummyFileSystem> Lower(new ErrorDummyFileSystem());
Lower->addDirectory("//root/a");
Lower->addDirectory("//root/a/aa");
Lower->addDirectory("//root/b");
Lower->addDirectory("//root/b/bb");
Lower->addDirectory("//root/c");
Lower->addDirectory("//root/c/cc");

IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLRawString(Buffer, Lower);
ASSERT_TRUE(FS.get() != nullptr);

EXPECT_TRUE(FS->exists(a.Path));
EXPECT_TRUE(FS->exists(_a_aa.Path));
EXPECT_TRUE(FS->exists(b.Path));
EXPECT_TRUE(FS->exists(_b_bb.Path));
EXPECT_TRUE(FS->exists(c.Path));
EXPECT_TRUE(FS->exists(_c_cc.Path));
}

TEST(YAMLVFSWriterTest, HandleRootAsVPath) {
llvm::SmallVector<char, 32> Tmp;
llvm::sys::path::system_temp_directory(false, Tmp);
llvm::StringRef Root = llvm::sys::path::root_path(StringRef(Tmp.data(), Tmp.size())).str();
llvm::SmallVector<char, 32> Subdir(Root.begin(), Root.end());
llvm::sys::path::append(Subdir, "foo");

llvm::vfs::YAMLVFSWriter W;
W.addDirectoryMapping(Root, "/tmp");
W.addDirectoryMapping(std::string{Subdir.begin(), Subdir.end()} + "/foo", "/tmp/bar");
std::string Dump;
llvm::raw_string_ostream ToBeIgnored(Dump);

EXPECT_NO_FATAL_FAILURE(W.write(ToBeIgnored));
}

0 comments on commit e4e3e41

Please sign in to comment.