diff options
author | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2019-03-29 23:32:47 +0000 |
---|---|---|
committer | Hubert Tong <hubert.reinterpretcast@gmail.com> | 2019-03-29 23:32:47 +0000 |
commit | 24168852e8b52b0e11294e606f86f4dde195eee7 (patch) | |
tree | 20ac0e8c483368f22fd80f5efec6ac90ed958fae /llvm/unittests/Support/Path.cpp | |
parent | 4d6fb5789fca8857c5161a621892b69a23a53d25 (diff) | |
download | bcm5719-llvm-24168852e8b52b0e11294e606f86f4dde195eee7.tar.gz bcm5719-llvm-24168852e8b52b0e11294e606f86f4dde195eee7.zip |
[Support] Implement is_local_impl with AIX mntctl
Summary:
On AIX, we can determine whether a filesystem is remote using `mntctl`.
If the information is not found, then claim that the file is remote
(since that is the more restrictive case). Testing for the associated
interface is restored with a modified version of the unit test from
rL295768.
Reviewers: jasonliu, xingxue
Reviewed By: xingxue
Subscribers: jsji, apaprocki, Hahnfeld, zturner, krytarowski, kristina, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58801
llvm-svn: 357333
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 7ce6d2d52db..3c0f7936030 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -1492,6 +1492,29 @@ TEST_F(FileSystemTest, ReadWriteFileCanReadOrWrite) { verifyWrite(FD, "Buzz", true); } +TEST_F(FileSystemTest, is_local) { + bool TestDirectoryIsLocal; + ASSERT_NO_ERROR(fs::is_local(TestDirectory, TestDirectoryIsLocal)); + EXPECT_EQ(TestDirectoryIsLocal, fs::is_local(TestDirectory)); + + int FD; + SmallString<128> TempPath; + ASSERT_NO_ERROR( + fs::createUniqueFile(Twine(TestDirectory) + "/temp", FD, TempPath)); + FileRemover Cleanup(TempPath); + + // Make sure it exists. + ASSERT_TRUE(sys::fs::exists(Twine(TempPath))); + + bool TempFileIsLocal; + ASSERT_NO_ERROR(fs::is_local(FD, TempFileIsLocal)); + EXPECT_EQ(TempFileIsLocal, fs::is_local(FD)); + + // Expect that the file and its parent directory are equally local or equally + // remote. + EXPECT_EQ(TestDirectoryIsLocal, TempFileIsLocal); +} + TEST_F(FileSystemTest, set_current_path) { SmallString<128> path; |