summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Orth <ro@gcc.gnu.org>2019-06-28 18:29:18 +0000
committerRainer Orth <ro@gcc.gnu.org>2019-06-28 18:29:18 +0000
commit36c3d1312a07a8ac6dcb1a87300b320dea46b02f (patch)
tree8072af725f792769d661ba3bf8ec6a41043aef52
parent93a290fdc974007ed3eeb7be11b527f66f43a01d (diff)
downloadbcm5719-llvm-36c3d1312a07a8ac6dcb1a87300b320dea46b02f.tar.gz
bcm5719-llvm-36c3d1312a07a8ac6dcb1a87300b320dea46b02f.zip
[unittests][Support] Fix LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions on Solaris
LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions currently FAILs on Solaris: FAIL: LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions (2940 of 51555) ******************** TEST 'LLVM-Unit :: Support/./SupportTests/FileSystemTest.permissions' FAILED ******************** Note: Google Test filter = FileSystemTest.permissions [==========] Running 1 test from 1 test case. [----------] Global test environment set-up. [----------] 1 test from FileSystemTest [ RUN ] FileSystemTest.permissions /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1705: Failure Value of: CheckPermissions(fs::sticky_bit) Actual: false Expected: true /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1712: Failure Value of: CheckPermissions(fs::set_uid_on_exe | fs::set_gid_on_exe | fs::sticky_bit) Actual: false Expected: true /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1719: Failure Value of: CheckPermissions(fs::all_read | fs::set_uid_on_exe | fs::set_gid_on_exe | fs::sticky_bit) Actual: false Expected: true /opt/llvm-buildbot/obj/llvm/llvm.src/unittests/Support/Path.cpp:1722: Failure Value of: CheckPermissions(fs::all_perms) Actual: false Expected: true [ FAILED ] FileSystemTest.permissions (0 ms) [----------] 1 test from FileSystemTest (0 ms total) [----------] Global test environment tear-down [==========] 1 test from 1 test case ran. (1 ms total) [ PASSED ] 0 tests. [ FAILED ] 1 test, listed below: [ FAILED ] FileSystemTest.permissions 1 FAILED TEST Checking with truss reveals that this is the same issue as on AIX and documented in chmod(2): If the process is not a privileged process and the file is not a direc- tory, mode bit 01000 (S_ISVTX, the sticky bit) is cleared. The following patch fixes this in the same way. Tested on amd64-pc-solaris2.11. Differential Revision: https://reviews.llvm.org/D63598 llvm-svn: 364671
-rw-r--r--llvm/unittests/Support/Path.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/unittests/Support/Path.cpp b/llvm/unittests/Support/Path.cpp
index e95342c5b58..1f4fee49d78 100644
--- a/llvm/unittests/Support/Path.cpp
+++ b/llvm/unittests/Support/Path.cpp
@@ -1751,9 +1751,10 @@ TEST_F(FileSystemTest, permissions) {
EXPECT_TRUE(CheckPermissions(fs::set_gid_on_exe));
// Modern BSDs require root to set the sticky bit on files.
- // AIX without root will mask off (i.e., lose) the sticky bit on files.
+ // AIX and Solaris without root will mask off (i.e., lose) the sticky bit
+ // on files.
#if !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && \
- !defined(_AIX)
+ !defined(_AIX) && !(defined(__sun__) && defined(__svr4__))
EXPECT_EQ(fs::setPermissions(TempPath, fs::sticky_bit), NoError);
EXPECT_TRUE(CheckPermissions(fs::sticky_bit));
OpenPOWER on IntegriCloud