Skip to content

Commit 84ca07f

Browse files
mdh1418Mitchell Hwangakoeplinger
authored
[libraries] Update System.Runtime.Extensions tests for iOS,MacCatalyst,tvOS (#57210)
* [libraries] Update AppDomainTests for iOS,MacCatalyst,tvOS * Update skip reasons * Add MacCatalyst to Case Insensitive and remove ActiveIssues * Replace ActiveIssue with ConditionalTheory based on RemoteExecutor * Fix test for iOS/tvOS/Catalyst * Skip UserName test on iOS tvOS Co-authored-by: Mitchell Hwang <mitchell.hwang@microsoft.com> Co-authored-by: Alexander Köplinger <alex.koeplinger@outlook.com>
1 parent 30a2709 commit 84ca07f

File tree

5 files changed

+9
-13
lines changed

5 files changed

+9
-13
lines changed

src/libraries/Common/tests/TestUtilities/System/PlatformDetection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public static partial class PlatformDetection
5454
public static bool Is64BitProcess => IntPtr.Size == 8;
5555
public static bool IsNotWindows => !IsWindows;
5656

57-
public static bool IsCaseInsensitiveOS => IsWindows || IsOSX;
57+
public static bool IsCaseInsensitiveOS => IsWindows || IsOSX || IsMacCatalyst;
5858
public static bool IsCaseSensitiveOS => !IsCaseInsensitiveOS;
5959

6060
public static bool IsThreadingSupported => !IsBrowser;

src/libraries/System.Runtime.Extensions/tests/System/AppDomainTests.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,8 +798,6 @@ public static void GetPermissionSet()
798798
}
799799

800800
[Theory]
801-
[ActiveIssue("https://github.com/dotnet/runtime/issues/34030", TestPlatforms.Linux | TestPlatforms.Browser, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
802-
[ActiveIssue("https://github.com/dotnet/runtime/issues/36896", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
803801
[MemberData(nameof(TestingCreateInstanceFromObjectHandleData))]
804802
public static void TestingCreateInstanceFromObjectHandle(string physicalFileName, string assemblyFile, string type, string returnedFullNameType, Type exceptionType)
805803
{
@@ -910,9 +908,7 @@ public static void TestingCreateInstanceObjectHandle(string assemblyName, string
910908
};
911909

912910
[Theory]
913-
[ActiveIssue("https://github.com/dotnet/runtime/issues/34030", TestPlatforms.Linux | TestPlatforms.Browser, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)]
914911
[MemberData(nameof(TestingCreateInstanceFromObjectHandleFullSignatureData))]
915-
[ActiveIssue("https://github.com/dotnet/runtime/issues/36896", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
916912
public static void TestingCreateInstanceFromObjectHandleFullSignature(string physicalFileName, string assemblyFile, string type, bool ignoreCase, BindingFlags bindingAttr, Binder binder, object[] args, CultureInfo culture, object[] activationAttributes, string returnedFullNameType)
917913
{
918914
ObjectHandle oh = AppDomain.CurrentDomain.CreateInstanceFrom(assemblyFile: assemblyFile, typeName: type, ignoreCase: ignoreCase, bindingAttr: bindingAttr, binder: binder, args: args, culture: culture, activationAttributes: activationAttributes);

src/libraries/System.Runtime.Extensions/tests/System/Environment.Exit.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,10 @@ public static void ExitCode_Roundtrips(int exitCode)
3737
Environment.ExitCode = 0; // in case the test host has a void returning Main
3838
}
3939

40-
[Theory]
40+
[ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))]
4141
[InlineData(1)] // setting ExitCode and exiting Main
4242
[InlineData(2)] // setting ExitCode both from Main and from an Unloading event handler.
4343
[InlineData(3)] // using Exit(exitCode)
44-
[SkipOnPlatform(TestPlatforms.Android | TestPlatforms.Browser | TestPlatforms.iOS | TestPlatforms.MacCatalyst | TestPlatforms.tvOS, "Not supported on Android, Browser, iOS, MacCatalyst, or tvOS.")]
4544
public static void ExitCode_VoidMainAppReturnsSetValue(int mode)
4645
{
4746
int expectedExitCode = 123;

src/libraries/System.Runtime.Extensions/tests/System/Environment.UserName.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public void UserNameIsCorrect()
2222
}
2323

2424
[Fact]
25-
[ActiveIssue("https://github.com/dotnet/runtime/issues/36896", TestPlatforms.iOS | TestPlatforms.tvOS)]
25+
[SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "Not valid on iOS or tvOS")]
2626
public void UserName_Valid()
2727
{
2828
string name = Environment.UserName;

src/libraries/System.Runtime.Extensions/tests/System/EnvironmentTests.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ public void OSVersion_ValidVersion()
161161

162162
// On non-OSX Unix, we must parse the version from uname -r
163163
[Theory]
164-
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.OSX & ~TestPlatforms.Browser)]
164+
[PlatformSpecific(TestPlatforms.AnyUnix & ~TestPlatforms.OSX & ~TestPlatforms.Browser & ~TestPlatforms.iOS & ~TestPlatforms.tvOS & ~TestPlatforms.MacCatalyst)]
165165
[InlineData("2.6.19-1.2895.fc6", 2, 6, 19, 1)]
166166
[InlineData("xxx1yyy2zzz3aaa4bbb", 1, 2, 3, 4)]
167167
[InlineData("2147483647.2147483647.2147483647.2147483647", int.MaxValue, int.MaxValue, int.MaxValue, int.MaxValue)]
@@ -171,7 +171,6 @@ public void OSVersion_ValidVersion()
171171
[InlineData("nelknet 4.15.0-24201807041620-generic", 4, 15, 0, int.MaxValue)] // integer overflow
172172
[InlineData("", 0, 0, 0, 0)]
173173
[InlineData("1abc", 1, 0, 0, 0)]
174-
[ActiveIssue("https://github.com/dotnet/runtime/issues/36896", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
175174
public void OSVersion_ParseVersion(string input, int major, int minor, int build, int revision)
176175
{
177176
var getOSMethod = typeof(Environment).GetMethod("GetOperatingSystem", BindingFlags.Static | BindingFlags.NonPublic);
@@ -333,11 +332,13 @@ public void FailFast_ExceptionStackTrace_InnerException()
333332

334333
[Fact]
335334
[PlatformSpecific(TestPlatforms.AnyUnix | TestPlatforms.Browser)] // Tests OS-specific environment
336-
[ActiveIssue("https://github.com/dotnet/runtime/issues/36896", TestPlatforms.iOS | TestPlatforms.tvOS | TestPlatforms.MacCatalyst)]
337335
public void GetFolderPath_Unix_PersonalIsHomeAndUserProfile()
338336
{
339-
Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.Personal));
340-
Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
337+
if (!PlatformDetection.IsiOS && !PlatformDetection.IstvOS && !PlatformDetection.IsMacCatalyst)
338+
{
339+
Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.Personal));
340+
Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));
341+
}
341342
Assert.Equal(Environment.GetEnvironmentVariable("HOME"), Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));
342343
}
343344

0 commit comments

Comments
 (0)