[PATCH] D32120: Don't test setting sticky bits on files for (Free|Open)BSD

Dimitry Andric via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 16 06:36:22 PDT 2017


dim created this revision.

In https://reviews.llvm.org/rL297945, jhenderson added methods for setting permissions to
sys::fs, but some of the unittests that attempt to set sticky bits
(01000) on files fail on FreeBSD and OpenBSD.  This is because those
systems do not allow regular users to set sticky bits on files, only on
directories.  Fix it by disabling these particular tests on FreeBSD and
OpenBSD.


https://reviews.llvm.org/D32120

Files:
  unittests/Support/Path.cpp


Index: unittests/Support/Path.cpp
===================================================================
--- unittests/Support/Path.cpp
+++ unittests/Support/Path.cpp
@@ -1515,6 +1515,8 @@
   EXPECT_EQ(fs::setPermissions(TempPath, fs::set_gid_on_exe), NoError);
   EXPECT_TRUE(CheckPermissions(fs::set_gid_on_exe));
 
+  // FreeBSD and OpenBSD require root to set the sticky bit on files.
+#if !defined(__FreeBSD__) && !defined(__OpenBSD__)
   EXPECT_EQ(fs::setPermissions(TempPath, fs::sticky_bit), NoError);
   EXPECT_TRUE(CheckPermissions(fs::sticky_bit));
 
@@ -1534,6 +1536,7 @@
 
   EXPECT_EQ(fs::setPermissions(TempPath, fs::all_perms), NoError);
   EXPECT_TRUE(CheckPermissions(fs::all_perms));
+#endif // !FreeBSD && !OpenBSD
 #endif
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32120.95406.patch
Type: text/x-patch
Size: 745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170416/03c666ac/attachment.bin>


More information about the llvm-commits mailing list