summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/unittests/Support/Path.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index 86ad57f3f3f..426aff47c74 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -1515,6 +1515,8 @@ TEST_F(FileSystemTest, permissions) {
EXPECT_EQ(fs::setPermissions(TempPath, fs::set_gid_on_exe), NoError);
EXPECT_TRUE(CheckPermissions(fs::set_gid_on_exe));
+ // Modern BSDs require root to set the sticky bit on files.
+#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__)
EXPECT_EQ(fs::setPermissions(TempPath, fs::sticky_bit), NoError);
EXPECT_TRUE(CheckPermissions(fs::sticky_bit));
@@ -1534,6 +1536,11 @@ TEST_F(FileSystemTest, permissions) {
EXPECT_EQ(fs::setPermissions(TempPath, fs::all_perms), NoError);
EXPECT_TRUE(CheckPermissions(fs::all_perms));
+#endif // !FreeBSD && !NetBSD && !OpenBSD
+
+ EXPECT_EQ(fs::setPermissions(TempPath, fs::all_perms & ~fs::sticky_bit),
+ NoError);
+ EXPECT_TRUE(CheckPermissions(fs::all_perms & ~fs::sticky_bit));
#endif
}
OpenPOWER on IntegriCloud