diff options
author | Zachary Turner <zturner@google.com> | 2017-03-10 17:47:13 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-03-10 17:47:13 +0000 |
commit | aeab48abdc839865e7a8c919122decf6c3c208f5 (patch) | |
tree | 32bfbad32a2927d43df7b4058e8208fe6d1c240c /llvm/unittests/Support/Path.cpp | |
parent | e48ace6a65514a4f71669c50fd5d4ead67acdc7f (diff) | |
download | bcm5719-llvm-aeab48abdc839865e7a8c919122decf6c3c208f5.tar.gz bcm5719-llvm-aeab48abdc839865e7a8c919122decf6c3c208f5.zip |
Fix test failure when Home directory cannot be found.
llvm-svn: 297484
Diffstat (limited to 'llvm/unittests/Support/Path.cpp')
-rw-r--r-- | llvm/unittests/Support/Path.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp index 571edaafbb6..c9c98f5d70b 100644 --- a/llvm/unittests/Support/Path.cpp +++ b/llvm/unittests/Support/Path.cpp @@ -522,15 +522,14 @@ TEST_F(FileSystemTest, RealPath) { EXPECT_EQ(Expected, Actual); SmallString<64> HomeDir; - ASSERT_TRUE(llvm::sys::path::home_directory(HomeDir)); - ASSERT_NO_ERROR(fs::real_path(HomeDir, Expected)); - ASSERT_NO_ERROR(fs::real_path("~", Actual, true)); - EXPECT_EQ(Expected, Actual); - ASSERT_NO_ERROR(fs::real_path("~/", Actual, true)); - EXPECT_EQ(Expected, Actual); - - fs::real_path(Twine(TestDirectory) + "/does_not_exist", Actual); - EXPECT_EQ("", Actual); + bool Result = llvm::sys::path::home_directory(HomeDir); + if (Result) { + ASSERT_NO_ERROR(fs::real_path(HomeDir, Expected)); + ASSERT_NO_ERROR(fs::real_path("~", Actual, true)); + EXPECT_EQ(Expected, Actual); + ASSERT_NO_ERROR(fs::real_path("~/", Actual, true)); + EXPECT_EQ(Expected, Actual); + } ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/test1")); } |