summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Support
diff options
context:
space:
mode:
authorAmara Emerson <aemerson@apple.com>2019-01-14 18:32:09 +0000
committerAmara Emerson <aemerson@apple.com>2019-01-14 18:32:09 +0000
commite07cdb107e775cdb872752a95d1f622b2c1097fd (patch)
treea635402f60b39983dcc381799b4293cb0ae10390 /llvm/unittests/Support
parent0d039525dfeab9c3b39581e949cc7394057cb747 (diff)
downloadbcm5719-llvm-e07cdb107e775cdb872752a95d1f622b2c1097fd.tar.gz
bcm5719-llvm-e07cdb107e775cdb872752a95d1f622b2c1097fd.zip
Revert "[VFS] Allow multiple RealFileSystem instances with independent CWDs."
This reverts commit r351079, r351069 and r351050 as it broken the greendragon bots on macOS. llvm-svn: 351091
Diffstat (limited to 'llvm/unittests/Support')
-rw-r--r--llvm/unittests/Support/VirtualFileSystemTest.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index b072712c638..7b42943f0fd 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -382,25 +382,6 @@ struct ScopedLink {
}
operator StringRef() { return Path.str(); }
};
-
-struct ScopedFile {
- SmallString<128> Path;
- ScopedFile(const Twine &Path, StringRef Contents) {
- Path.toVector(this->Path);
- std::error_code EC;
- raw_fd_ostream OS(this->Path, EC);
- EXPECT_FALSE(EC);
- OS << Contents;
- OS.flush();
- EXPECT_FALSE(OS.error());
- if (EC || OS.error())
- this->Path = "";
- }
- ~ScopedFile() {
- if (Path != "")
- EXPECT_FALSE(llvm::sys::fs::remove(Path.str()));
- }
-};
} // end anonymous namespace
TEST(VirtualFileSystemTest, BasicRealFSIteration) {
@@ -431,67 +412,6 @@ TEST(VirtualFileSystemTest, BasicRealFSIteration) {
}
#ifdef LLVM_ON_UNIX
-TEST(VirtualFileSystemTest, MultipleWorkingDirs) {
- // Our root contains a/aa, b/bb, c, where c is a link to a/.
- // Run tests both in root/b/ and root/c/ (to test "normal" and symlink dirs).
- // Interleave operations to show the working directories are independent.
- ScopedDir Root("r", true), ADir(Root.Path + "/a"), BDir(Root.Path + "/b");
- ScopedLink C(ADir.Path, Root.Path + "/c");
- ScopedFile AA(ADir.Path + "/aa", "aaaa"), BB(BDir.Path + "/bb", "bbbb");
- std::unique_ptr<vfs::FileSystem> BFS = vfs::createPhysicalFileSystem(),
- CFS = vfs::createPhysicalFileSystem();
-
- ASSERT_FALSE(BFS->setCurrentWorkingDirectory(BDir.Path));
- ASSERT_FALSE(CFS->setCurrentWorkingDirectory(C.Path));
- EXPECT_EQ(BDir.Path, *BFS->getCurrentWorkingDirectory());
- EXPECT_EQ(C.Path, *CFS->getCurrentWorkingDirectory());
-
- // openFileForRead(), indirectly.
- auto BBuf = BFS->getBufferForFile("bb");
- ASSERT_TRUE(BBuf);
- EXPECT_EQ("bbbb", (*BBuf)->getBuffer());
-
- auto ABuf = CFS->getBufferForFile("aa");
- ASSERT_TRUE(ABuf);
- EXPECT_EQ("aaaa", (*ABuf)->getBuffer());
-
- // status()
- auto BStat = BFS->status("bb");
- ASSERT_TRUE(BStat);
- EXPECT_EQ("bb", BStat->getName());
-
- auto AStat = CFS->status("aa");
- ASSERT_TRUE(AStat);
- EXPECT_EQ("aa", AStat->getName()); // unresolved name
-
- // getRealPath()
- SmallString<128> BPath;
- ASSERT_FALSE(BFS->getRealPath("bb", BPath));
- EXPECT_EQ(BB.Path, BPath);
-
- SmallString<128> APath;
- ASSERT_FALSE(CFS->getRealPath("aa", APath));
- EXPECT_EQ(AA.Path, APath); // Reports resolved name.
-
- // dir_begin
- std::error_code EC;
- auto BIt = BFS->dir_begin(".", EC);
- ASSERT_FALSE(EC);
- ASSERT_NE(BIt, vfs::directory_iterator());
- EXPECT_EQ((BDir.Path + "/./bb").str(), BIt->path());
- BIt.increment(EC);
- ASSERT_FALSE(EC);
- ASSERT_EQ(BIt, vfs::directory_iterator());
-
- auto CIt = CFS->dir_begin(".", EC);
- ASSERT_FALSE(EC);
- ASSERT_NE(CIt, vfs::directory_iterator());
- EXPECT_EQ((ADir.Path + "/./aa").str(), CIt->path()); // Partly resolved name!
- CIt.increment(EC); // Because likely to read through this path.
- ASSERT_FALSE(EC);
- ASSERT_EQ(CIt, vfs::directory_iterator());
-}
-
TEST(VirtualFileSystemTest, BrokenSymlinkRealFSIteration) {
ScopedDir TestDirectory("virtual-file-system-test", /*Unique*/ true);
IntrusiveRefCntPtr<vfs::FileSystem> FS = vfs::getRealFileSystem();
OpenPOWER on IntegriCloud