summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sal/qa/osl/file/osl_File.cxx33
1 files changed, 30 insertions, 3 deletions
diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx
index 2eac7d1688af..718fb65423d1 100644
--- a/sal/qa/osl/file/osl_File.cxx
+++ b/sal/qa/osl/file/osl_File.cxx
@@ -1716,9 +1716,18 @@ namespace osl_FileStatus
osl::FileBase::RC nError = rItem.getFileStatus(rFileStatus);
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, nError);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("test for getAttributes function: ReadOnly, GrpRead, OwnRead, OthRead(UNX version) ",
+ if (geteuid() == 0) // as root, access(W_OK) may be true despite mode
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test for getAttributes function: (not ReadOnly,) GrpRead, OwnRead, OthRead(UNX version) ",
+ static_cast<sal_uInt64>(osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead),
+ rFileStatus.getAttributes());
+ }
+ else
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test for getAttributes function: ReadOnly, GrpRead, OwnRead, OthRead(UNX version) ",
static_cast<sal_uInt64>(osl_File_Attribute_ReadOnly | osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead),
rFileStatus.getAttributes());
+ }
}
#else // Windows version
void getAttributes_001()
@@ -1737,9 +1746,18 @@ namespace osl_FileStatus
osl::FileBase::RC nError = rItem.getFileStatus(rFileStatus);
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, nError);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("test for getAttributes function: Executable, GrpExe, OwnExe, OthExe, the result is Readonly, Executable, GrpExe, OwnExe, OthExe, it partly not pass(Solaris version)",
+ if (geteuid() == 0) // as root, access(W_OK) may be true despite mode
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test for getAttributes function: Executable, GrpExe, OwnExe, OthExe, the result is (not Readonly,) Executable, GrpExe, OwnExe, OthExe, it partly not pass(Solaris version)",
+ static_cast<sal_uInt64>(osl_File_Attribute_Executable | osl_File_Attribute_GrpExe | osl_File_Attribute_OwnExe | osl_File_Attribute_OthExe),
+ rFileStatus.getAttributes());
+ }
+ else
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test for getAttributes function: Executable, GrpExe, OwnExe, OthExe, the result is Readonly, Executable, GrpExe, OwnExe, OthExe, it partly not pass(Solaris version)",
static_cast<sal_uInt64>(osl_File_Attribute_ReadOnly | osl_File_Attribute_Executable | osl_File_Attribute_GrpExe | osl_File_Attribute_OwnExe | osl_File_Attribute_OthExe),
rFileStatus.getAttributes());
+ }
#endif
}
@@ -3259,9 +3277,18 @@ namespace osl_File
nError1 = rItem.getFileStatus(rFileStatus);
CPPUNIT_ASSERT_EQUAL(osl::FileBase::E_None, nError1);
- CPPUNIT_ASSERT_EQUAL_MESSAGE("test for setAttributes function: set file attributes and get it to verify.",
+ if (geteuid() == 0) // as root, access(W_OK) may be true despite mode
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test for setAttributes function: set file attributes and get it to verify.",
+ static_cast<sal_uInt64>(osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead),
+ rFileStatus.getAttributes());
+ }
+ else
+ {
+ CPPUNIT_ASSERT_EQUAL_MESSAGE("test for setAttributes function: set file attributes and get it to verify.",
static_cast<sal_uInt64>(osl_File_Attribute_ReadOnly | osl_File_Attribute_GrpRead | osl_File_Attribute_OwnRead | osl_File_Attribute_OthRead),
rFileStatus.getAttributes());
+ }
#else
// please see GetFileAttributes
auto nError2 = File::setAttributes(aTmpName6, osl_File_Attribute_ReadOnly);