#include "llvm/Support/VirtualFileSystem.h"
#include "llvm/ADT/IntrusiveRefCntPtr.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/Errc.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/TargetParser/Host.h"
#include "llvm/TargetParser/Triple.h"
#include "llvm/Testing/Support/SupportHelpers.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include <map>
#include <string>
usingnamespacellvm;
UniqueID;
TempDir;
TempFile;
TempLink;
ElementsAre;
Pair;
UnorderedElementsAre;
namespace {
struct DummyFile : public vfs::File { … };
class DummyFileSystem : public vfs::FileSystem { … };
class ErrorDummyFileSystem : public DummyFileSystem { … };
class NoStatusDummyFileSystem : public DummyFileSystem { … };
std::string getPosixPath(const Twine &S) { … }
}
TEST(VirtualFileSystemTest, StatusQueries) { … }
TEST(VirtualFileSystemTest, BaseOnlyOverlay) { … }
TEST(VirtualFileSystemTest, GetRealPathInOverlay) { … }
TEST(VirtualFileSystemTest, OverlayFiles) { … }
TEST(VirtualFileSystemTest, OverlayDirsNonMerged) { … }
TEST(VirtualFileSystemTest, MergedDirPermissions) { … }
TEST(VirtualFileSystemTest, OverlayIterator) { … }
TEST(VirtualFileSystemTest, BasicRealFSIteration) { … }
#ifdef LLVM_ON_UNIX
TEST(VirtualFileSystemTest, MultipleWorkingDirs) { … }
TEST(VirtualFileSystemTest, PhysicalFileSystemWorkingDirFailure) { … }
TEST(VirtualFileSystemTest, BrokenSymlinkRealFSIteration) { … }
#endif
TEST(VirtualFileSystemTest, BasicRealFSRecursiveIteration) { … }
TEST(VirtualFileSystemTest, BasicRealFSRecursiveIterationNoPush) { … }
#ifdef LLVM_ON_UNIX
TEST(VirtualFileSystemTest, BrokenSymlinkRealFSRecursiveIteration) { … }
#endif
template <typename DirIter>
static void checkContents(DirIter I, ArrayRef<StringRef> ExpectedOut) { … }
TEST(VirtualFileSystemTest, OverlayIteration) { … }
TEST(VirtualFileSystemTest, OverlayRecursiveIteration) { … }
TEST(VirtualFileSystemTest, ThreeLevelIteration) { … }
TEST(VirtualFileSystemTest, HiddenInIteration) { … }
TEST(VirtualFileSystemTest, Visit) { … }
TEST(OverlayFileSystemTest, PrintOutput) { … }
TEST(OverlayFileSystemTest, Exists) { … }
TEST(ProxyFileSystemTest, Basic) { … }
class InMemoryFileSystemTest : public ::testing::Test { … };
MATCHER_P2(IsHardLinkTo, FS, Target, "") { … }
TEST_F(InMemoryFileSystemTest, IsEmpty) { … }
TEST_F(InMemoryFileSystemTest, WindowsPath) { … }
TEST_F(InMemoryFileSystemTest, OverlayFile) { … }
TEST_F(InMemoryFileSystemTest, OverlayFileNoOwn) { … }
TEST_F(InMemoryFileSystemTest, OpenFileForRead) { … }
TEST_F(InMemoryFileSystemTest, DuplicatedFile) { … }
TEST_F(InMemoryFileSystemTest, DirectoryIteration) { … }
TEST_F(InMemoryFileSystemTest, WorkingDirectory) { … }
TEST_F(InMemoryFileSystemTest, IsLocal) { … }
#if !defined(_WIN32)
TEST_F(InMemoryFileSystemTest, GetRealPath) { … }
#endif
TEST_F(InMemoryFileSystemTest, AddFileWithUser) { … }
TEST_F(InMemoryFileSystemTest, AddFileWithGroup) { … }
TEST_F(InMemoryFileSystemTest, AddFileWithFileType) { … }
TEST_F(InMemoryFileSystemTest, AddFileWithPerms) { … }
TEST_F(InMemoryFileSystemTest, AddDirectoryThenAddChild) { … }
TEST_F(InMemoryFileSystemTest, StatusName) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkToFile) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkInChainPattern) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkToAFileThatWasNotAddedBefore) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkFromAFileThatWasAddedBefore) { … }
TEST_F(InMemoryFileSystemTest, AddSameHardLinkMoreThanOnce) { … }
TEST_F(InMemoryFileSystemTest, AddFileInPlaceOfAHardLinkWithSameContent) { … }
TEST_F(InMemoryFileSystemTest, AddFileInPlaceOfAHardLinkWithDifferentContent) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkToADirectory) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkToASymlink) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkFromADirectory) { … }
TEST_F(InMemoryFileSystemTest, AddHardLinkUnderAFile) { … }
TEST_F(InMemoryFileSystemTest, RecursiveIterationWithHardLink) { … }
TEST_F(InMemoryFileSystemTest, UniqueID) { … }
TEST_F(InMemoryFileSystemTest, AddSymlinkToAFile) { … }
TEST_F(InMemoryFileSystemTest, AddSymlinkToADirectory) { … }
TEST_F(InMemoryFileSystemTest, AddSymlinkToASymlink) { … }
TEST_F(InMemoryFileSystemTest, AddRecursiveSymlink) { … }
TEST_F(InMemoryFileSystemTest, DirectoryIteratorWithSymlinkToAFile) { … }
TEST_F(InMemoryFileSystemTest, RecursiveDirectoryIteratorWithSymlinkToADir) { … }
class VFSFromYAMLTest : public ::testing::Test { … };
TEST_F(VFSFromYAMLTest, BasicVFSFromYAML) { … }
TEST_F(VFSFromYAMLTest, MappedFiles) { … }
TEST_F(VFSFromYAMLTest, MappedRoot) { … }
TEST_F(VFSFromYAMLTest, RemappedDirectoryOverlay) { … }
TEST_F(VFSFromYAMLTest, RemappedDirectoryOverlayNoExternalNames) { … }
TEST_F(VFSFromYAMLTest, RemappedDirectoryOverlayNoFallthrough) { … }
TEST_F(VFSFromYAMLTest, ReturnsRequestedPathVFSMiss) { … }
TEST_F(VFSFromYAMLTest, ReturnsExternalPathVFSHit) { … }
TEST_F(VFSFromYAMLTest, RootRelativeTest) { … }
TEST_F(VFSFromYAMLTest, ReturnsInternalPathVFSHit) { … }
TEST_F(VFSFromYAMLTest, CaseInsensitive) { … }
TEST_F(VFSFromYAMLTest, CaseSensitive) { … }
TEST_F(VFSFromYAMLTest, IllegalVFSFile) { … }
TEST_F(VFSFromYAMLTest, UseExternalName) { … }
TEST_F(VFSFromYAMLTest, MultiComponentPath) { … }
TEST_F(VFSFromYAMLTest, TrailingSlashes) { … }
TEST_F(VFSFromYAMLTest, DirectoryIteration) { … }
TEST_F(VFSFromYAMLTest, DirectoryIterationSameDirMultipleEntries) { … }
TEST_F(VFSFromYAMLTest, RecursiveDirectoryIterationLevel) { … }
TEST_F(VFSFromYAMLTest, RelativePaths) { … }
TEST_F(VFSFromYAMLTest, NonFallthroughDirectoryIteration) { … }
TEST_F(VFSFromYAMLTest, DirectoryIterationWithDuplicates) { … }
TEST_F(VFSFromYAMLTest, DirectoryIterationErrorInVFSLayer) { … }
TEST_F(VFSFromYAMLTest, GetRealPath) { … }
TEST_F(VFSFromYAMLTest, WorkingDirectory) { … }
TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthrough) { … }
TEST_F(VFSFromYAMLTest, WorkingDirectoryFallthroughInvalid) { … }
TEST_F(VFSFromYAMLTest, VirtualWorkingDirectory) { … }
TEST_F(VFSFromYAMLTest, YAMLVFSWriterTest) { … }
TEST_F(VFSFromYAMLTest, YAMLVFSWriterTest2) { … }
TEST_F(VFSFromYAMLTest, YAMLVFSWriterTest3) { … }
TEST_F(VFSFromYAMLTest, YAMLVFSWriterTestHandleDirs) { … }
TEST_F(VFSFromYAMLTest, RedirectingWith) { … }
TEST(VFSFromRemappedFilesTest, Basic) { … }
TEST(VFSFromRemappedFilesTest, UseExternalNames) { … }
TEST(VFSFromRemappedFilesTest, LastMappingWins) { … }
TEST(RedirectingFileSystemTest, PrintOutput) { … }
TEST(RedirectingFileSystemTest, Used) { … }
TEST(RedirectingFileSystemTest, ExternalPaths) { … }
TEST(RedirectingFileSystemTest, Exists) { … }
TEST(RedirectingFileSystemTest, ExistsFallback) { … }
TEST(RedirectingFileSystemTest, ExistsRedirectOnly) { … }
TEST(TracingFileSystemTest, TracingWorks) { … }
TEST(TracingFileSystemTest, PrintOutput) { … }