-
Notifications
You must be signed in to change notification settings - Fork 5.1k
[wasm] Addressing System.Runtime.Extensions failures #38996
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
Merged
akoeplinger
merged 22 commits into
dotnet:master
from
mdh1418:mdhwang/address_system_runtime_extensions_tests
Jul 13, 2020
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
35a79fc
[wasm] Reenable some skipped tests in System.Runtime.Extensions.Tests
5c905bf
[wasm] PathTests GetFullPath_CoreTests skip test case on browser
cad48bb
[wasm] System.Runtime.Extensions Tests throwing PNSE
f8b3c60
[wasm] System.Runtime.Extensions tests throwing Cannot wait on monito…
9e41643
[wasm] System.Runtime.Extensions tests with ActiveIssues
0558735
[wasm] System.Runtime.Extensions test throwing EntryPointNotFoundExce…
c05deb2
[wasm] AppDomainTests modify expected FriendlyName
b19d161
Add Environment.Browser to eliminate p-invokes that were not function…
f1a5975
Adjust ICU dependent tests
c128f6d
Remove browser skip on WorkingSet_Valid
9745d57
Feedback
ff310ff
Feedback PathTests.cs
4a223ed
[wasm] EnvironmentTests Assert Environment.Workinset equals 0
1038c09
[wasm] StringComparer Use IsNotInvariantGlobalization instead of IsIc…
bf0521e
Remove System.Runtime.Extensions from skip test list
b937af6
[wasm] Return emscripten for GetComputerName on Browser
53350a0
Add back in Environment.UnixOrBrowser
f625e66
Cleaned up a few comments
3a4ea9c
Merge branch 'master' into mdhwang/address_system_runtime_extensions_…
akoeplinger 8d13b06
Merge branch 'master' into mdhwang/address_system_runtime_extensions_…
akoeplinger 952997c
PR Feedback
c7343fa
One more thing...
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/libraries/System.Private.CoreLib/src/System/Environment.Browser.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
namespace System | ||
{ | ||
public static partial class Environment | ||
{ | ||
// Emscripten VFS mounts at / and is the only drive | ||
public static string[] GetLogicalDrives() => new string[] { "/" }; | ||
|
||
// In the mono runtime, this maps to gethostname, which returns 'emscripten'. | ||
// Returning the value here allows us to exclude more of the runtime. | ||
public static string MachineName => "localhost"; | ||
|
||
// Matching what we returned for an earlier release. There isn't an established equivalent | ||
// on wasm. | ||
public static long WorkingSet => 0; | ||
|
||
public static string UserName => "Browser"; | ||
|
||
private static OperatingSystem GetOSVersion() | ||
{ | ||
return new OperatingSystem(PlatformID.Other, new Version(1, 0, 0, 0)); | ||
} | ||
} | ||
} |
14 changes: 0 additions & 14 deletions
14
src/libraries/System.Private.CoreLib/src/System/Environment.OSVersion.Browser.cs
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
src/libraries/System.Private.CoreLib/src/System/Environment.UnixOrBrowser.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
using System.Text; | ||
using System.Threading; | ||
|
||
namespace System | ||
{ | ||
public static partial class Environment | ||
{ | ||
public static bool UserInteractive => true; | ||
|
||
private static string CurrentDirectoryCore | ||
{ | ||
get => Interop.Sys.GetCwd(); | ||
set => Interop.CheckIo(Interop.Sys.ChDir(value), value, isDirectory: true); | ||
} | ||
|
||
private static string ExpandEnvironmentVariablesCore(string name) | ||
{ | ||
var result = new ValueStringBuilder(stackalloc char[128]); | ||
|
||
int lastPos = 0, pos; | ||
while (lastPos < name.Length && (pos = name.IndexOf('%', lastPos + 1)) >= 0) | ||
{ | ||
if (name[lastPos] == '%') | ||
{ | ||
string key = name.Substring(lastPos + 1, pos - lastPos - 1); | ||
string? value = GetEnvironmentVariable(key); | ||
if (value != null) | ||
{ | ||
result.Append(value); | ||
lastPos = pos + 1; | ||
continue; | ||
} | ||
} | ||
result.Append(name.AsSpan(lastPos, pos - lastPos)); | ||
lastPos = pos; | ||
} | ||
result.Append(name.AsSpan(lastPos)); | ||
|
||
return result.ToString(); | ||
} | ||
|
||
private static bool Is64BitOperatingSystemWhen32BitProcess => false; | ||
|
||
private static int GetCurrentProcessId() => Interop.Sys.GetPid(); | ||
|
||
internal const string NewLineConst = "\n"; | ||
|
||
public static string SystemDirectory => GetFolderPathCore(SpecialFolder.System, SpecialFolderOption.None); | ||
|
||
public static int SystemPageSize => CheckedSysConf(Interop.Sys.SysConfName._SC_PAGESIZE); | ||
|
||
public static string UserDomainName => MachineName; | ||
|
||
/// <summary>Invoke <see cref="Interop.Sys.SysConf"/>, throwing if it fails.</summary> | ||
private static int CheckedSysConf(Interop.Sys.SysConfName name) | ||
{ | ||
long result = Interop.Sys.SysConf(name); | ||
if (result == -1) | ||
{ | ||
Interop.ErrorInfo errno = Interop.Sys.GetLastErrorInfo(); | ||
throw errno.Error == Interop.Error.EINVAL ? | ||
new ArgumentOutOfRangeException(nameof(name), name, errno.GetErrorMessage()) : | ||
Interop.GetIOException(errno); | ||
} | ||
return (int)result; | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.