[llvm] cf1521e - [llvm] Update FileSystem test that failed spuriously
Ben Langmuir via llvm-commits
llvm-commits at lists.llvm.org
Sat Aug 13 18:17:21 PDT 2022
Author: Ben Langmuir
Date: 2022-08-13T18:17:04-07:00
New Revision: cf1521e8cc7160008d1f148a159cd64c4a188f5b
URL: https://github.com/llvm/llvm-project/commit/cf1521e8cc7160008d1f148a159cd64c4a188f5b
DIFF: https://github.com/llvm/llvm-project/commit/cf1521e8cc7160008d1f148a159cd64c4a188f5b.diff
LOG: [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.
Added:
Modified:
llvm/unittests/Support/Path.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 08460a9502e2..3b8ffd8fee94 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -828,15 +828,14 @@ TEST_F(FileSystemTest, RemoveDirectoriesNoExePerm) {
ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
/*IgnoreErrors=*/true));
- ASSERT_TRUE(fs::exists(Twine(TestDirectory) + "/noexeperm"));
- ASSERT_EQ(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
- /*IgnoreErrors=*/false),
- errc::permission_denied);
-
- fs::setPermissions(Twine(TestDirectory) + "/noexeperm", fs::all_perms);
- ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
- /*IgnoreErrors=*/false));
+ // It's expected that the directory exists, but some environments appear to
+ // allow the removal despite missing the 'x' permission, so be flexible.
+ if (fs::exists(Twine(TestDirectory) + "/noexeperm")) {
+ fs::setPermissions(Twine(TestDirectory) + "/noexeperm", fs::all_perms);
+ ASSERT_NO_ERROR(fs::remove_directories(Twine(TestDirectory) + "/noexeperm",
+ /*IgnoreErrors=*/false));
+ }
}
#endif
More information about the llvm-commits
mailing list