From e9e76079745dc2eb9de11badacaa9665a2c39511 Mon Sep 17 00:00:00 2001 From: Benjamin Kramer Date: Sat, 9 Jan 2016 16:33:16 +0000 Subject: [vfs] Normalize working directory if requested. FixedCompilationDatabase sets the working dir to "." by default. For chdir(".") this is a noop but this lead to InMemoryFileSystem to create bogus paths. Fixes PR25327. llvm-svn: 257260 --- clang/unittests/Basic/VirtualFileSystemTest.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/unittests/Basic/VirtualFileSystemTest.cpp') diff --git a/clang/unittests/Basic/VirtualFileSystemTest.cpp b/clang/unittests/Basic/VirtualFileSystemTest.cpp index ac07035..b72b757 100644 --- a/clang/unittests/Basic/VirtualFileSystemTest.cpp +++ b/clang/unittests/Basic/VirtualFileSystemTest.cpp @@ -657,6 +657,12 @@ TEST_F(InMemoryFileSystemTest, WorkingDirectory) { Stat = FS.status("c"); ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString(); + + NormalizedFS.setCurrentWorkingDirectory("/b/c"); + NormalizedFS.setCurrentWorkingDirectory("."); + ASSERT_EQ("/b/c", NormalizedFS.getCurrentWorkingDirectory().get()); + NormalizedFS.setCurrentWorkingDirectory(".."); + ASSERT_EQ("/b", NormalizedFS.getCurrentWorkingDirectory().get()); } // NOTE: in the tests below, we use '//root/' as our root directory, since it is -- cgit v1.1