1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
llvm-mirror/unittests/Support
James Henderson dff2d6c589 [Support] Add support for getting file system permissions on Windows and implement sys::fs::set/getPermissions to work with them
This change adds support for functions to set and get file permissions, in a similar manner to the C++17 permissions() function in <filesystem>. The setter uses chmod on Unix systems and SetFileAttributes on Windows, setting the permissions as passed in. The getter simply uses the existing status() function.

Prior to this change, status() would always return an unknown value for the permissions on a Windows file, making it impossible to test the new function on Windows. I have therefore added support for this as well. On Linux, prior to this change, the permissions included the file type, which should actually be accessed via a different member of the file_status class.

Note that on Windows, only the *_write permission bits have any affect - if any are set, the file is writable, and if not, the file is read-only. This is in common with what MSDN describes for their behaviour of std::filesystem::permissions(), and also what boost::filesystem does.

The motivation behind this change is so that we can easily test behaviour on read-only files in LLVM unit tests, but I am sure that others may find it useful in some situations.

Reviewers: zturner, amccarth, aaron.ballman

Differential Revision: https://reviews.llvm.org/D30736

llvm-svn: 297945
2017-03-16 11:22:09 +00:00
..
AlignOfTest.cpp Revert r291503, "Lift the 10-type limit for AlignedCharArrayUnion", and followings. 2017-01-13 01:13:10 +00:00
AllocatorTest.cpp [unittest] Explicitly specify alignment when using BumpPtrAllocator. 2017-03-11 01:24:56 +00:00
ARMAttributeParser.cpp [ARM] const cast fix for ARMAttributeParser test 2017-02-01 12:58:57 +00:00
ArrayRecyclerTest.cpp
BinaryStreamTest.cpp [unittest] Explicitly specify alignment when using BumpPtrAllocator. 2017-03-11 01:24:56 +00:00
BlockFrequencyTest.cpp
BranchProbabilityTest.cpp BranchProbabilityTest.cpp: Suppress warnings. [-Wsign-compare] 2015-12-18 00:18:18 +00:00
CachePruningTest.cpp Support: Add a cache pruning policy parser. 2017-03-16 03:42:00 +00:00
Casting.cpp
Chrono.cpp [Support] Add FormatVariadic support for chrono types 2017-02-07 18:11:33 +00:00
CMakeLists.txt Support: Add a cache pruning policy parser. 2017-03-16 03:42:00 +00:00
CommandLineTest.cpp [Support][CommandLine] Make it possible to get error messages from ParseCommandLineOptions when ignoring errors. 2017-03-15 08:41:00 +00:00
CompressionTest.cpp Recommit r292214 "[Support/Compression] - Change zlib API to return Error instead of custom status" 2017-01-17 15:45:07 +00:00
ConvertUTFTest.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00
DataExtractorTest.cpp
DebugTest.cpp Fix unit test in NDEBUG build 2016-12-27 11:07:53 +00:00
DwarfTest.cpp Re-commit "Use StringRef in Support/Darf APIs (NFC)" 2016-10-05 05:59:29 +00:00
EndianStreamTest.cpp Add a test showing we can write a vector of floats. 2016-01-25 19:02:20 +00:00
EndianTest.cpp
ErrorOrTest.cpp Use std::forward to make ErrorOr<T> constructible from a value that has a user-defined conversion to T. No functionality change intended. 2016-02-09 04:47:58 +00:00
ErrorTest.cpp [Support][Error] Add a 'cantFail' utility function for known-safe calls to 2017-02-27 21:09:47 +00:00
FileOutputBufferTest.cpp Fix a real temp file leak in FileOutputBuffer 2016-09-02 01:10:53 +00:00
formatted_raw_ostream_test.cpp
FormatVariadicTest.cpp [Support] Add formatv support for StringLiteral 2017-02-14 16:35:56 +00:00
GlobPatternTest.cpp Move GlobPattern class from LLD to llvm/Support. 2016-12-20 23:09:09 +00:00
Host.cpp [Support] Simplify triple check in Host CPU test. NFC. 2017-02-04 00:46:59 +00:00
LEB128Test.cpp [Support] Extend SLEB128 encoding support. 2017-02-10 00:02:58 +00:00
LineIteratorTest.cpp
LockFileManagerTest.cpp
ManagedStatic.cpp
MathExtrasTest.cpp [ADT/MathExtras] Make buildbot happy again. 2016-11-11 04:03:29 +00:00
MD5Test.cpp Add convenient functions to compute hashes of byte vectors. 2016-11-23 00:46:09 +00:00
MemoryBufferTest.cpp Try to fix some temp file leaks in SupportTests, PR18335 2016-09-02 00:51:34 +00:00
MemoryTest.cpp
NativeFormatTests.cpp [Support] Introduce llvm::formatv() function. 2016-11-11 23:57:40 +00:00
Path.cpp [Support] Add support for getting file system permissions on Windows and implement sys::fs::set/getPermissions to work with them 2017-03-16 11:22:09 +00:00
ProcessTest.cpp
ProgramTest.cpp Remove unused lambda captures. NFC 2017-01-13 17:12:16 +00:00
raw_ostream_test.cpp Bring back r297624. 2017-03-13 20:00:25 +00:00
raw_pwrite_stream_test.cpp raw_pwrite_stream_test.cpp: _putenv_s() may be assumed as win32-generic. 2016-09-02 01:20:18 +00:00
raw_sha1_ostream_test.cpp Add convenient functions to compute hashes of byte vectors. 2016-11-23 00:46:09 +00:00
RegexTest.cpp [Support] - Fix possible crash in match() of llvm::Regex. 2016-09-02 08:44:46 +00:00
ReplaceFileTest.cpp
ScaledNumberTest.cpp
SourceMgrTest.cpp
SpecialCaseListTest.cpp Support escaping in TrigramIndex. 2016-12-02 23:30:16 +00:00
StringPool.cpp
SwapByteOrderTest.cpp
TargetParserTest.cpp [AArch64] Vulcan is now ThunderXT99 2017-03-07 19:42:40 +00:00
TarWriterTest.cpp Use EXPECT_EQ instead of ASSERT_EQ in a unit test. 2017-01-11 22:02:51 +00:00
Threading.cpp Rename interface for querying physical hardware concurrency 2016-10-17 14:56:53 +00:00
ThreadLocalTest.cpp
ThreadPool.cpp Remove unused lambda captures. NFC 2017-01-13 17:12:16 +00:00
TimerTest.cpp Timer: Track name and description. 2016-11-18 19:43:18 +00:00
TrailingObjectsTest.cpp Workaround MSVC bug when using TrailingObjects from a template. 2017-02-28 18:05:41 +00:00
TrigramIndexTest.cpp Support escaping in TrigramIndex. 2016-12-02 23:30:16 +00:00
TypeNameTest.cpp [Support] Add a fancy helper function to get a static name for a type. 2016-02-25 03:58:21 +00:00
UnicodeTest.cpp
xxhashTest.cpp Add xxhash to llvm. 2016-09-27 15:45:57 +00:00
YAMLIOTest.cpp Support: Add YAML I/O support for custom mappings. 2017-01-04 03:51:36 +00:00
YAMLParserTest.cpp [NFC] Header cleanup 2016-04-18 09:17:29 +00:00