Home | History | Annotate | Download | only in Basic

Lines Matching refs:FS

20 using llvm::sys::fs::UniqueID;
116 void addRegularFile(StringRef Path, sys::fs::perms Perms = sys::fs::all_all) {
118 1024, sys::fs::file_type::regular_file, Perms);
122 void addDirectory(StringRef Path, sys::fs::perms Perms = sys::fs::all_all) {
124 0, sys::fs::file_type::directory_file, Perms);
130 0, sys::fs::file_type::symlink_file, sys::fs::all_all);
266 Lower->addDirectory("/both", sys::fs::owner_read);
267 Upper->addDirectory("/both", sys::fs::owner_all | sys::fs::group_read);
273 Lower->addRegularFile("/both/foo", sys::fs::owner_read);
274 Upper->addRegularFile("/both/bar", sys::fs::owner_write);
289 EC = llvm::sys::fs::createUniqueDirectory(Name, Path);
292 EC = llvm::sys::fs::create_directory(Twine(Path));
300 EXPECT_FALSE(llvm::sys::fs::remove(Path.str()));
308 IntrusiveRefCntPtr<vfs::FileSystem> FS = vfs::getRealFileSystem();
311 vfs::directory_iterator I = FS->dir_begin(Twine(TestDirectory), EC);
320 I = FS->dir_begin(Twine(TestDirectory), EC);
335 IntrusiveRefCntPtr<vfs::FileSystem> FS = vfs::getRealFileSystem();
338 auto I = vfs::recursive_directory_iterator(*FS, Twine(TestDirectory), EC);
347 I = vfs::recursive_directory_iterator(*FS, Twine(TestDirectory), EC);
505 Lower->addRegularFile("/onlyInLow", sys::fs::owner_read);
506 Lower->addRegularFile("/hiddenByMid", sys::fs::owner_read);
507 Lower->addRegularFile("/hiddenByUp", sys::fs::owner_read);
508 Middle->addRegularFile("/onlyInMid", sys::fs::owner_write);
509 Middle->addRegularFile("/hiddenByMid", sys::fs::owner_write);
510 Middle->addRegularFile("/hiddenByUp", sys::fs::owner_write);
511 Upper->addRegularFile("/onlyInUp", sys::fs::owner_all);
512 Upper->addRegularFile("/hiddenByUp", sys::fs::owner_all);
527 EXPECT_EQ(sys::fs::owner_all, I->getPermissions());
536 EXPECT_EQ(sys::fs::owner_write, I->getPermissions());
542 clang::vfs::InMemoryFileSystem FS;
546 : FS(/*UseNormalizedPaths=*/false),
551 auto Stat = FS.status("/a");
552 ASSERT_EQ(Stat.getError(),errc::no_such_file_or_directory) << FS.toString();
553 Stat = FS.status("/");
554 ASSERT_EQ(Stat.getError(), errc::no_such_file_or_directory) << FS.toString();
558 FS.addFile("c:/windows/system128/foo.cpp", 0, MemoryBuffer::getMemBuffer(""));
559 auto Stat = FS.status("c:");
561 ASSERT_FALSE(Stat.getError()) << Stat.getError() << FS.toString();
563 Stat = FS.status("c:/windows/system128/foo.cpp");
564 ASSERT_FALSE(Stat.getError()) << Stat.getError() << FS.toString();
565 FS.addFile("d:/windows/foo.cpp", 0, MemoryBuffer::getMemBuffer(""));
566 Stat = FS.status("d:/windows/foo.cpp");
567 ASSERT_FALSE(Stat.getError()) << Stat.getError() << FS.toString();
571 FS.addFile("/a", 0, MemoryBuffer::getMemBuffer("a"));
573 auto Stat = FS.status("/");
574 ASSERT_FALSE(Stat.getError()) << Stat.getError() << FS.toString();
575 Stat = FS.status("/.");
578 ASSERT_FALSE(Stat.getError()) << Stat.getError() << FS.toString();
579 Stat = FS.status("/a");
580 ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
586 FS.addFileNoOwn("/a", 0, Buf.get());
587 auto Stat = FS.status("/a");
588 ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
593 FS.addFile("/a", 0, MemoryBuffer::getMemBuffer("a"));
594 FS.addFile("././c", 0, MemoryBuffer::getMemBuffer("c"));
595 FS.addFile("./d/../d", 0, MemoryBuffer::getMemBuffer("d"));
599 auto File = FS.openFileForRead("/a");
601 File = FS.openFileForRead("/a"); // Open again.
605 File = FS.openFileForRead("/");
606 ASSERT_EQ(File.getError(), errc::invalid_argument) << FS.toString();
607 File = FS.openFileForRead("/b");
608 ASSERT_EQ(File.getError(), errc::no_such_file_or_directory) << FS.toString();
609 File = FS.openFileForRead("./c");
611 File = FS.openFileForRead("e/../d");
620 ASSERT_TRUE(FS.addFile("/a", 0, MemoryBuffer::getMemBuffer("a")));
621 ASSERT_FALSE(FS.addFile("/a/b", 0, MemoryBuffer::getMemBuffer("a")));
622 ASSERT_TRUE(FS.addFile("/a", 0, MemoryBuffer::getMemBuffer("a")));
623 ASSERT_FALSE(FS.addFile("/a", 0, MemoryBuffer::getMemBuffer("b")));
627 FS.addFile("/a", 0, MemoryBuffer::getMemBuffer(""));
628 FS.addFile("/b/c", 0, MemoryBuffer::getMemBuffer(""));
631 vfs::directory_iterator I = FS.dir_begin("/", EC);
641 I = FS.dir_begin("/b", EC);
650 FS.setCurrentWorkingDirectory("/b");
651 FS.addFile("c", 0, MemoryBuffer::getMemBuffer(""));
653 auto Stat = FS.status("/b/c");
654 ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
656 ASSERT_EQ("/b", *FS.getCurrentWorkingDirectory());
658 Stat = FS.status("c");
659 ASSERT_FALSE(Stat.getError()) << Stat.getError() << "\n" << FS.toString();
693 IntrusiveRefCntPtr<vfs::FileSystem> FS;
694 FS = getFromYAMLString("");
695 EXPECT_EQ(nullptr, FS.get());
696 FS = getFromYAMLString("[]");
697 EXPECT_EQ(nullptr, FS.get());
698 FS = getFromYAMLString("'string'");
699 EXPECT_EQ(nullptr, FS.get());
706 IntrusiveRefCntPtr<vfs::FileSystem> FS =
726 ASSERT_TRUE(FS.get() != nullptr);
730 O->pushOverlay(FS);
766 IntrusiveRefCntPtr<vfs::FileSystem> FS =
780 ASSERT_TRUE(FS.get() != nullptr);
784 O->pushOverlay(FS);
802 IntrusiveRefCntPtr<vfs::FileSystem> FS =
816 ASSERT_TRUE(FS.get() != nullptr);
820 O->pushOverlay(FS);
835 IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString("{]", Lower);
836 EXPECT_EQ(nullptr, FS.get());
838 FS = getFromYAMLString("{ 'roots':[}", Lower);
840 FS = getFromYAMLString(
843 EXPECT_EQ(nullptr, FS.get());
846 FS = getFromYAMLString("{ 'knobular': 'true', 'roots':[] }", Lower);
847 EXPECT_EQ(nullptr, FS.get());
848 FS = getFromYAMLString("{ 'case-sensitive': 'maybe', 'roots':[] }", Lower);
849 EXPECT_EQ(nullptr, FS.get());
852 FS = getFromYAMLString("{ 'roots':'' }", Lower);
853 EXPECT_EQ(nullptr, FS.get());
854 FS = getFromYAMLString("{ 'roots':{} }", Lower);
855 EXPECT_EQ(nullptr, FS.get());
858 FS = getFromYAMLString(
860 EXPECT_EQ(nullptr, FS.get());
861 FS = getFromYAMLString("{ 'roots':[ { 'type': 'file', 'name': [], "
864 EXPECT_EQ(nullptr, FS.get());
865 FS = getFromYAMLString(
868 EXPECT_EQ(nullptr, FS.get());
869 FS = getFromYAMLString(
872 EXPECT_EQ(nullptr, FS.get());
873 FS = getFromYAMLString(
876 EXPECT_EQ(nullptr, FS.get());
877 FS = getFromYAMLString(
880 EXPECT_EQ(nullptr, FS.get());
881 FS = getFromYAMLString(
884 EXPECT_EQ(nullptr, FS.get());
887 FS = getFromYAMLString("{ 'roots':[ { 'type': 'file', 'name': 'me' }", Lower);
888 EXPECT_EQ(nullptr, FS.get());
889 FS = getFromYAMLString(
891 EXPECT_EQ(nullptr, FS.get());
892 FS = getFromYAMLString("{ 'roots':[ { 'name': 'me', 'contents': [] }", Lower);
893 EXPECT_EQ(nullptr, FS.get());
896 FS = getFromYAMLString("{ 'roots':[], 'roots':[] }", Lower);
897 EXPECT_EQ(nullptr, FS.get());
898 FS = getFromYAMLString(
901 EXPECT_EQ(nullptr, FS.get());
902 FS =
906 EXPECT_EQ(nullptr, FS.get());
909 FS = getFromYAMLRawString("{ 'roots':[] }", Lower);
910 EXPECT_EQ(nullptr, FS.get());
913 FS = getFromYAMLRawString("{ 'version':'foo', 'roots':[] }", Lower);
914 EXPECT_EQ(nullptr, FS.get());
915 FS = getFromYAMLRawString("{ 'version':-1, 'roots':[] }", Lower);
916 EXPECT_EQ(nullptr, FS.get());
917 FS
918 EXPECT_EQ(nullptr, FS.get());
926 IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString(
940 ASSERT_TRUE(nullptr != FS.get());
943 EXPECT_EQ("//root/external/file", FS->status("//root/A")->getName());
945 EXPECT_EQ("//root/external/file", FS->status("//root/B")->getName());
946 EXPECT_EQ("//root/C", FS->status("//root/C")->getName());
949 FS = getFromYAMLString(
964 ASSERT_TRUE(nullptr != FS.get());
967 EXPECT_EQ("//root/A", FS->status("//root/A")->getName());
969 EXPECT_EQ("//root/external/file", FS->status("//root/B")->getName());
970 EXPECT_EQ("//root/C", FS->status("//root/C")->getName());
978 IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString(
983 ASSERT_TRUE(nullptr != FS.get());
984 EXPECT_FALSE(FS->status("//root/path/to/file").getError());
985 EXPECT_FALSE(FS->status("//root/path/to").getError());
986 EXPECT_FALSE(FS->status("//root/path").getError());
987 EXPECT_FALSE(FS->status("//root/").getError());
990 FS = getFromYAMLString(
996 ASSERT_TRUE(nullptr != FS.get());
997 EXPECT_FALSE(FS->status("//root/path/to/file").getError());
998 EXPECT_FALSE(FS->status("//root/path/to").getError());
999 EXPECT_FALSE(FS->status("//root/path").getError());
1000 EXPECT_FALSE(FS->status("//root/").getError());
1003 FS = getFromYAMLString(
1009 ASSERT_TRUE(nullptr != FS.get());
1010 EXPECT_FALSE(FS->status("//root/path/to/file").getError());
1011 EXPECT_FALSE(FS->status("//root/path/to").getError());
1012 EXPECT_FALSE(FS->status("//root/path").getError());
1013 EXPECT_FALSE(FS->status("//root/").getError());
1021 IntrusiveRefCntPtr<vfs::FileSystem> FS = getFromYAMLString(
1027 ASSERT_TRUE(nullptr != FS.get());
1028 EXPECT_FALSE(FS->status("//root/path/to/file").getError());
1029 EXPECT_FALSE(FS->status("//root/path/to").getError());
1030 EXPECT_FALSE(FS->status("//root/path").getError());
1031 EXPECT_FALSE(FS->status("//root/").getError());
1042 IntrusiveRefCntPtr<vfs::FileSystem> FS =
1063 ASSERT_TRUE(FS.get() != nullptr);
1067 O->pushOverlay(FS);