summaryrefslogtreecommitdiffstats
path: root/unittests
diff options
context:
space:
mode:
authorEric Liu <ioeric@google.com>2018-07-11 18:43:07 +0000
committerEric Liu <ioeric@google.com>2018-07-11 18:43:07 +0000
commit27d314134831ebd9f50c94189c021169e973ca3d (patch)
treee62a1639e78eb8636dcdb6ed2c9c86bd6113fee5 /unittests
parent1d90e7314049f86752943b0568a805a7f11b7b89 (diff)
Revert "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name"
This reverts commit r336807. This breaks users of ClangTool::mapVirtualFile. Will try to investigate a fix. See also the discussion on https://reviews.llvm.org/D48903 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@336831 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests')
-rw-r--r--unittests/Basic/VirtualFileSystemTest.cpp33
-rw-r--r--unittests/Driver/ToolChainTest.cpp2
2 files changed, 2 insertions, 33 deletions
diff --git a/unittests/Basic/VirtualFileSystemTest.cpp b/unittests/Basic/VirtualFileSystemTest.cpp
index 54c355d948..c795be07ac 100644
--- a/unittests/Basic/VirtualFileSystemTest.cpp
+++ b/unittests/Basic/VirtualFileSystemTest.cpp
@@ -794,7 +794,7 @@ TEST_F(InMemoryFileSystemTest, WorkingDirectory) {
auto Stat = FS.status("/b/c");
ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
- ASSERT_EQ("/b/c", Stat->getName());
+ ASSERT_EQ("c", Stat->getName());
ASSERT_EQ("/b", *FS.getCurrentWorkingDirectory());
Stat = FS.status("c");
@@ -919,37 +919,6 @@ TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) {
ASSERT_TRUE(Stat->isRegularFile());
}
-// Test that the name returned by status() is in the same form as the path that
-// was requested (to match the behavior of RealFileSystem).
-TEST_F(InMemoryFileSystemTest, StatusName) {
- NormalizedFS.addFile("/a/b/c", 0, MemoryBuffer::getMemBuffer("abc"),
- /*User=*/None,
- /*Group=*/None, sys::fs::file_type::regular_file);
- NormalizedFS.setCurrentWorkingDirectory("/a/b");
-
- // Access using InMemoryFileSystem::status.
- auto Stat = NormalizedFS.status("../b/c");
- ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n"
- << NormalizedFS.toString();
- ASSERT_TRUE(Stat->isRegularFile());
- ASSERT_EQ("../b/c", Stat->getName());
-
- // Access using InMemoryFileAdaptor::status.
- auto File = NormalizedFS.openFileForRead("../b/c");
- ASSERT_FALSE(File.getError()) << File.getError() << "\n"
- << NormalizedFS.toString();
- Stat = (*File)->status();
- ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n"
- << NormalizedFS.toString();
- ASSERT_TRUE(Stat->isRegularFile());
- ASSERT_EQ("../b/c", Stat->getName());
-
- // Access using a directory iterator.
- std::error_code EC;
- clang::vfs::directory_iterator It = NormalizedFS.dir_begin("../b", EC);
- ASSERT_EQ("../b/c", It->getName());
-}
-
// NOTE: in the tests below, we use '//root/' as our root directory, since it is
// a legal *absolute* path on Windows as well as *nix.
class VFSFromYAMLTest : public ::testing::Test {
diff --git a/unittests/Driver/ToolChainTest.cpp b/unittests/Driver/ToolChainTest.cpp
index 0d4c545bd7..d4198eaeb1 100644
--- a/unittests/Driver/ToolChainTest.cpp
+++ b/unittests/Driver/ToolChainTest.cpp
@@ -113,7 +113,7 @@ TEST(ToolChainTest, VFSGCCInstallationRelativeDir) {
std::replace(S.begin(), S.end(), '\\', '/');
#endif
EXPECT_EQ("Found candidate GCC installation: "
- "/home/test/bin/../lib/gcc/arm-linux-gnueabi/4.6.1\n"
+ "/home/test/lib/gcc/arm-linux-gnueabi/4.6.1\n"
"Selected GCC installation: "
"/home/test/bin/../lib/gcc/arm-linux-gnueabi/4.6.1\n"
"Candidate multilib: .;@m32\n"