Skip to content

Commit 46a9ac9

Browse files
committed
[llvm] Update FileSystem test that failed spuriously
This test failed spuriously in an environment that appears to ignore the 'x' bit permission on directories. Allow for that possibility. (cherry picked from commit cf1521e)
1 parent d863a78 commit 46a9ac9

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

llvm/unittests/Support/Path.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -828,15 +828,14 @@ TEST_F(FileSystemTest, RemoveDirectoriesNoExePerm) {
828828

829829
ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
830830
/*IgnoreErrors=*/true));
831-
ASSERT_TRUE(fs::exists(Twine(TestDirectory) + "/noexeperm"));
832-
ASSERT_EQ(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
833-
/*IgnoreErrors=*/false),
834-
errc::permission_denied);
835-
836-
fs::setPermissions(Twine(TestDirectory) + "/noexeperm", fs::all_perms);
837831

838-
ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
839-
/*IgnoreErrors=*/false));
832+
// It's expected that the directory exists, but some environments appear to
833+
// allow the removal despite missing the 'x' permission, so be flexible.
834+
if (fs::exists(Twine(TestDirectory) + "/noexeperm")) {
835+
fs::setPermissions(Twine(TestDirectory) + "/noexeperm", fs::all_perms);
836+
ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
837+
/*IgnoreErrors=*/false));
838+
}
840839
}
841840
#endif
842841

0 commit comments

Comments
 (0)