Skip to content
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

WASM: Fix System.IO.MemoryMappedFiles tests #39355

Merged
merged 1 commit into from
Jul 15, 2020

Conversation

akoeplinger
Copy link
Member

Allows the tests to run on WebAssembly: Tests run: 329, Errors: 0, Failures: 0, Skipped: 5. Time: 1.0009759s

Verified

This commit was signed with the committer’s verified signature.
CasperWA Casper Welzel Andersen
@@ -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));
Copy link
Member

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 when IsBrowser is false? Would hitting PNSE on windows be a problem?

Copy link
Member

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 the Windows check here, it would throw PlatformNotSupportedException and crash the tests.

Copy link
Member Author

@akoeplinger akoeplinger Jul 15, 2020

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 throw PlatformNotSupportedException if we ran it on Windows

edit GitHub didn't load @safern's comment at first so sorry for the double post 😄

@akoeplinger akoeplinger merged commit 46ca4d7 into dotnet:master Jul 15, 2020
@akoeplinger akoeplinger deleted the wasm-memory-mapped-files branch July 15, 2020 20:22
@@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it mean? Is the behaviour unexpected?

Copy link
Member Author

Choose a reason for hiding this comment

The 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)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please create a tracking issue instead of ignoring the tests

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@karelz karelz added this to the 5.0.0 milestone Aug 18, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants