diff options
author | Pavel Labath <labath@google.com> | 2017-01-24 11:35:26 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-01-24 11:35:26 +0000 |
commit | 504400977a1d85e62867d4ce5befc7dcb490e6d4 (patch) | |
tree | 69ffef2f0f541b1d808c44088c696df1907b874d /llvm/unittests/Support/Path.cpp | |
parent | 6340e548615c82de1d38a0c5dca6c82026e575d3 (diff) | |
download | bcm5719-llvm-504400977a1d85e62867d4ce5befc7dcb490e6d4.tar.gz bcm5719-llvm-504400977a1d85e62867d4ce5befc7dcb490e6d4.zip |
Fix fs::set_current_path unit test
The test fails when there is a symlink on the path because then the path
returned by current_path will not match the one we have set. Instead of
doing a string match check the unique id of the two files.
llvm-svn: 292916
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index fb61cc7c26e..bd57ba98f31 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -1151,7 +1151,11 @@ TEST_F(FileSystemTest, set_current_path) { ASSERT_NO_ERROR(fs::set_current_path(TestDirectory)); ASSERT_NO_ERROR(fs::current_path(path)); - ASSERT_EQ(TestDirectory, path); + + fs::UniqueID D1, D2; + ASSERT_NO_ERROR(fs::getUniqueID(TestDirectory, D1)); + ASSERT_NO_ERROR(fs::getUniqueID(path, D2)); + ASSERT_EQ(D1, D2) << "D1: " << TestDirectory << "\nD2: " << path; } } // anonymous namespace |