summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-12-11 09:50:00 -0800
committerJonas Devlieghere <jonas@devlieghere.com>2019-12-11 09:50:41 -0800
commitf2f774997357cc6690d8a2446140d0c4df83e828 (patch)
tree41e83fcf8db4b0304308cbbaab26c3591212a43b
parent7b774b7cd48562e3af3405b1e5c54ea58bd142a6 (diff)
downloadbcm5719-llvm-f2f774997357cc6690d8a2446140d0c4df83e828.tar.gz
bcm5719-llvm-f2f774997357cc6690d8a2446140d0c4df83e828.zip
[VFS] Extend virtual working directory test
Extend the virtual working directory test with a few edge cases that are not currently tested.
-rw-r--r--llvm/unittests/Support/VirtualFileSystemTest.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/unittests/Support/VirtualFileSystemTest.cpp b/llvm/unittests/Support/VirtualFileSystemTest.cpp
index 69e9ce80f79..87547b29c67 100644
--- a/llvm/unittests/Support/VirtualFileSystemTest.cpp
+++ b/llvm/unittests/Support/VirtualFileSystemTest.cpp
@@ -2089,6 +2089,16 @@ TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthrough) {
" 'external-contents': '//root/foo/a'\n"
" }\n"
" ]\n"
+ "},\n"
+ "{\n"
+ " 'type': 'directory',\n"
+ " 'name': '//root/bar/baz',\n"
+ " 'contents': [ {\n"
+ " 'type': 'file',\n"
+ " 'name': 'a',\n"
+ " 'external-contents': '//root/foo/a'\n"
+ " }\n"
+ " ]\n"
"}\n"
"]\n"
"}",
@@ -2125,6 +2135,21 @@ TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthrough) {
Status = FS->status("c");
ASSERT_FALSE(Status.getError());
EXPECT_TRUE(Status->exists());
+
+ Status = FS->status("./bar/baz/a");
+ ASSERT_FALSE(Status.getError());
+ EXPECT_TRUE(Status->exists());
+
+ EC = FS->setCurrentWorkingDirectory("//root/bar");
+ ASSERT_FALSE(EC);
+
+ Status = FS->status("./baz/a");
+ ASSERT_FALSE(Status.getError());
+ EXPECT_TRUE(Status->exists());
+
+ Status = FS->status("../bar/baz/a");
+ ASSERT_FALSE(Status.getError());
+ EXPECT_TRUE(Status->exists());
}
TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthroughInvalid) {
OpenPOWER on IntegriCloud