-
Notifications
You must be signed in to change notification settings - Fork 5.1k
WASM: Fix System.IO.MemoryMappedFiles tests #39355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -614,6 +614,7 @@ public void FileInUse_CreateFromFile_FailsWithExistingReadWriteMap() | |
/// Test exceptional behavior when trying to create a map for a non-shared file that's currently in use. | ||
/// </summary> | ||
[Fact] | ||
[PlatformSpecific(~TestPlatforms.Browser)] // the emscripten implementation ignores FileShare.None | ||
public void FileInUse_CreateFromFile_FailsWithExistingNoShareFile() | ||
{ | ||
// Already opened with a FileStream | ||
|
@@ -696,13 +697,13 @@ private void WriteToReadOnlyFile(MemoryMappedFileAccess access, bool succeeds) | |
public void WriteToReadOnlyFile_ReadWrite(MemoryMappedFileAccess access) | ||
{ | ||
WriteToReadOnlyFile(access, access == MemoryMappedFileAccess.Read || | ||
(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && geteuid() == 0)); | ||
(!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && PlatformDetection.IsSuperUser)); | ||
} | ||
|
||
[Fact] | ||
public void WriteToReadOnlyFile_CopyOnWrite() | ||
{ | ||
WriteToReadOnlyFile(MemoryMappedFileAccess.CopyOnWrite, (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && geteuid() == 0)); | ||
WriteToReadOnlyFile(MemoryMappedFileAccess.CopyOnWrite, (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && PlatformDetection.IsSuperUser)); | ||
} | ||
|
||
/// <summary> | ||
|
@@ -768,6 +769,7 @@ public void LeaveOpenRespected_OutstandingViews(bool leaveOpen) | |
/// Test to validate we can create multiple maps from the same FileStream. | ||
/// </summary> | ||
[Fact] | ||
[PlatformSpecific(~TestPlatforms.Browser)] // the emscripten implementation doesn't share data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What does it mean? Is the behaviour unexpected? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @marek-safar kind of, though sharing an mmap'd file is not the common case. we could probably looking into detecting the situation and throwing a proper exception (right now the second mmap just doesn't see the modifications from the first mmap) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please create a tracking issue instead of ignoring the tests There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
public void MultipleMapsForTheSameFileStream() | ||
{ | ||
const int Capacity = 4096; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it fine to remove
!RuntimeInformation.IsOSPlatform(OSPlatform.Windows) &&
since it feels redundant to check for windows twice whenIsBrowser
is false? Would hitting PNSE on windows be a problem?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the way that
IsSuperUser
is written, if we remove theWindows
check here, it would throwPlatformNotSupportedException
and crash the tests.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no we need to keep this since
PlatformDetection.IsSuperUser
would throwPlatformNotSupportedException
if we ran it on Windowsedit GitHub didn't load @safern's comment at first so sorry for the double post 😄