1
0
Fork 0
mirror of https://github.com/VSadov/Satori.git synced 2025-06-09 17:44:48 +09:00

handle UnauthorizedAccessException from mmap on OSX (#35619)

* handle UnauthorizedAccessException on OSX

* update SkipTestException text

* add comments

Co-authored-by: Tomas Weinfurt <furt@Shining.local>
This commit is contained in:
Tomas Weinfurt 2020-04-29 18:23:19 -07:00 committed by GitHub
parent 3735efbdb2
commit ac544ffe30
Signed by: github
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -91,9 +91,11 @@ namespace System.IO.MemoryMappedFiles.Tests
}
catch (UnauthorizedAccessException)
{
if (PlatformDetection.IsInContainer && (viewAccess == MemoryMappedFileAccess.ReadExecute || viewAccess == MemoryMappedFileAccess.ReadWriteExecute))
if ((RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || PlatformDetection.IsInContainer) &&
(viewAccess == MemoryMappedFileAccess.ReadExecute || viewAccess == MemoryMappedFileAccess.ReadWriteExecute))
{
throw new SkipTestException("Execute permission failing in container.");
// Containers and OSX with SIP enabled do not have execute permissions by default.
throw new SkipTestException("Insufficient execute permission.");
}
throw;

View file

@ -91,9 +91,11 @@ namespace System.IO.MemoryMappedFiles.Tests
}
catch (UnauthorizedAccessException)
{
if (PlatformDetection.IsInContainer && (viewAccess == MemoryMappedFileAccess.ReadExecute || viewAccess == MemoryMappedFileAccess.ReadWriteExecute))
if ((RuntimeInformation.IsOSPlatform(OSPlatform.OSX) || PlatformDetection.IsInContainer) &&
(viewAccess == MemoryMappedFileAccess.ReadExecute || viewAccess == MemoryMappedFileAccess.ReadWriteExecute))
{
throw new SkipTestException("Execute permission failing in container.");
// Containers and OSX with SIP enabled do not have execute permissions by default.
throw new SkipTestException("Insufficient execute permission.");
}
throw;